Tip

@Transform formula for use in R6

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.