@Transform formula for use in R6

These are a couple of formulas that this developer finds more effective than their LotusScript counterparts.

These are a couple of formulas that I find more effective than their LotusScript counterparts.

@Transform is one of the fantastic list processing formulas available in R6 & above. We can update and use each entry of the list using another formula like this.

Consider a list "1":"2":"3" contained by a field -- data on a form. In the default value for the textfield, data would be data. You have a button/hotspot/action named ChangeValues.

Put the following formula on the Click Event of the hotspot ChangeValues:

newData:=@Transform(data;"x";@TextToNumber(x)+1);
@SetField("data";newData)

Just put 1;2;3;4 as the value in the field when previewed the form in Notes client and click on the ChangeValues HotSpot. It will update the value in the textfield to 2;3;4;5 and so on.

Now I will give you a practical example from NAB, the Notes Address Book.

Most of the business giants prefer to have all the employee access controls on every asset or service using Lotus Notes. So a Global ID, or GID, is assigned to each employee (person document on Notes Address Book) and added to the document as an item.

Since two Names can be identical on Lotus Notes Server, the concept of GID is invented in large organizations. Now, if you had to create a simple web person lookup form using formula only, how would you go about doing it?

Here is the simplest solution. Create the following items or controls on the Administration/Web lookup form as follows:

1) Field: txtPersonName, text, editable, default value: txtPersonName

2) Button HotSpot: Get Details, and put the following javascript on the click event of this hotspot:
 document.forms[0].hGetDetails.click();

3) Field: ddMatchedFullNames, ComboBox, editable, 
default value: ddMatchedFullNames, 
use formula for choices: @Unique(@Explode(ddMatchedFullNames;",")), 
onChange event (js): var frm = document.forms[0]; frm.ddMatchedGIDs.selectedIndex = frm.ddMatchedFullNames.selectedIndex;

4) Field: ddMatchedGIDs, ComboBox, editable, 
default value: ddMatchedGIDs, 
use formula for choices: @Unique(@Explode(ddMatchedGids;",")), 
onChange event (js): var frm = document.forms[0]; frm.ddMatchedFullNames.selectedIndex = frm.ddMatchedGIDs.selectedIndex;

5) Hidden Button HotSpot: hGetDetails, 
Formula: fullNames:=@Explode(@NameLookup([Exhaustive];@Text(txtPersonName);"FullName");",");
gids:=@Transform(fullNames;"x";@NameLookup([Exhaustive];x;"VisionID"));
onlyNames:=@Transform(fullNames;"y";@Name([CN];y));
onlyNames=@If(@IsError(onlyNames);"No Such Name";onlyNames); 
gids=@If(@IsError(gids);"No Such GID";gids); @SetField("ddMatchedFullNames";onlyNames);
@SetField("ddMatchedGIDs";gids)

After doing all this, open the form in web and put the firstname or lastname or both in the textbox and click on GetDetails button. The comboboxes would be populated with the matching entries from the server NAB. Choose the one which is most appropriate to you.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Sunilkumar Vishwakarma. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our bimonthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was first published in July 2005
This Content Component encountered an error

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close