Manage Learn to apply best practices and optimize your operations.

Universal @Formula for converting list synonyms

Have you ever needed to use a list description and its synonym in different views? This universal @Formula script from SearchDomino.com member John Humphreys allows you to set a field with the description value of a list for later use.

VIEW MEMBER FEEDACK TO THIS TIP

Have you ever needed to use a list description and its synonym in different views?

This Formula script allows you to set a field with the description value of a list for later use.

The Formula code relies on the presence of the following conditions:

  1. You have a Profile Document called "profile."
  2. Your list field is called "xxxxxxList."
  3. Your form has a field to allows selection -- i.e. dialog/checkbox/etc. -- called "xxxxxx."
  4. You have "refresh fields on keyword change" selected.
  5. You have an addition computed text field with the name "xxxxxxText."

Once you've arranged the above parameters, use the Formula in the computed field to get the original list and find the synonym value, or return the description. Alternatively, you can use an input translation to set the 'text' field.

COMPUTED FIELD

fPfx := @Left(@ThisName;@Length(@ThisName)-4);
listNum := @Elements(@GetProfileField("profile";fPfx+"List"));
tmp:=  @GetField(fPfx);
@For(
n:=1;
n <= listNum;
n := n+1;
tmp := @If(@RightBack(@GetProfileField
("profile";fPfx+"List")[n];"|") = 
@GetField(fPfx);@LeftBack
(@GetProfileField("profile";fPfx+"List")
[n];"|");tmp));
tmp


INPUT TRANSLATION

fPfx := @ThisName;
listNum := @Elements
(@GetProfileField("profile";fPfx+"List"));
tmp:=  @ThisValue;
@For(
n:=1;
n <= listNum;
n := n+1;
tmp := @If(@RightBack(@GetProfileField
("profile";fPfx+"List")[n];"|") = 
@ThisValue;@LeftBack(@GetProfileField
("profile";fPfx+"List")[n];"|");tmp));
@SetField(fPfx+"Text";tmp)

@ThisValue

MEMBER FEEDBACK TO THIS TIP

When working with lists, you can also use @Transform instead of @For. In this case, you do not need to count the elements and use an index variable. The code for the same solution with @Transform would be something like this:

fPfx := @Left(@ThisName;
@Length(@ThisName)-4);

_resultlist := @Trim(@Transform(
@GetProfileField("profile";fPfx+"List"); 
x; @If(@RightBack(x;"|")=@GetField(fPfx);
@LeftBack(x;"|");
@Nothing)
));

_resultlist

Alternatively, we can return with @Implode(_resultlist)
—Gabor B.

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

Related information from SearchDomino.com:

  • Learning Guide: Formula Language
  • FAQ: Formula language
  • Tip: @Formula library
  • Tip: Expand group members and nested groups in @Formula
  • Reference Center: Formula language resources and tips

    This tip was submitted to the SearchDomino.com tip library by member John Humphreys. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

  • This was last published in February 2007

    Dig Deeper on Lotus Notes Domino Formula Language

    Start the conversation

    Send me notifications when other members comment.

    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

    Please create a username to comment.

    -ADS BY GOOGLE

    SearchWindowsServer

    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 ...

    SearchDataCenter

    SearchExchange

    SearchContentManagement

    Close