trying to pull elements out of a list

5 pts.
Tags:
Lotus Domino
LotusScript
I have a field, that is a dialog list that uses a dbLookup for the choices. The user can choose 1 or many choices. After the user makes the choices, I would like to separate each one into a separate field. For example, if "Apples, Oranges, Pears" is selected for that field, I would like separateField1 to contain "Apples", separateField2 to contain "Oranges", and so on. I have tried @Word(dialogList; " "; 1) to try and bring out the first element for separateField1, it doesn't work? What am I doing wrong? Help?
ASKED: August 25, 2004  10:30 AM
UPDATED: August 25, 2004  9:35 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Is this on the web, or on a notes client? Just off the top of my head, if it’s web based you can use some Javascript to populate each field with one element from the dialog list array – if its notes client, Lotus script can do the same thing – build an array from your selected dialog list choices, then each element from that array can populate each field.

HTH

Simon Molloy

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • Sirhoser
    @explode will return a text list. Look at the help file on @Explode.
    0 pointsBadges:
    report
  • Mt69
    The returned value list is divided by the separator which is selected in the field where you use the dblookup. With @elements you get the number of values in the list, with @Implode you get all values in one string. This string can be parsed with @Word and using the correct separator.
    0 pointsBadges:
    report
  • Jswalwell
    Multiple choice fields should contain an array (known as a list in formula language). @Subset( list; n ) will extract n elements from the list. Positive values of n will extract from the left and negative from the right. The first and last elements are easy to extract ( e.g. @Subset( dialogList; 1 )). Other elements require extracting a list up to the desired element and then extracting the last element, e.g. @Subset( @Subset( dialogList; 2 ); -1 ) to get the second element. Alternatively, you can implode the list into a string and then extract the word you want, e.g. tmp := @Implode( dialogList; "~" ); Field separateField2 := @Word( dialogList; "~"; 2 )
    0 pointsBadges:
    report
  • RobWills
    You need to decide whether to use @FORMULA commands or LotusScript which will depend upon the architecture etc. If you must use @FORMULA (or prefer to) then version 6 would be easier because it allows looping (see @FOR). This would reduce the coding involved. The problem with this approach is that you have to decide in advance what the maximum number of elements is going to be and create fields for this number. If you used LotusScript, you can create items for each element in the document without having to have a corresponding field on a form.
    0 pointsBadges:
    report
  • LoudSinger
    The reason @word doesnt work in that case is that @word is not a list function, but a string function. Here's how I would approach it in formula language: - Put the choices into a variable choice := @prompt(....); - COunt the number of elements num := @elements(choice); - number your fields with a numeric stem, e.g. Choice01, choice02 etc - Now You still can use @word, but w a slight change: convert the array "choice" to a string with @implode: choicelist := @implode(choices;"~") The second argument of @implode is the delimiter. I used ~ but you can use anything. - Next use @word, referring to the first, second, etc, item, as defined by that delimiter delim := "~"; field ch1 := @word(choicelist;delim;1); - If you can use Notes 6.x, there is a wonderful @for function that lets you assign variable numbers.. Here's an example of @for from the help. @For(n :=1; n
    0 pointsBadges:
    report
  • MatNewman
    This operation can be performed easily using the following formula: FIELD separateField1:=@Unique(separateField1:DispField) You can download an application from my web-site that uses this process to add an element from one list to another. http://www.iteam.com.au Go to the "Site Extra's" menu, choose "Tech Tips" and then open the "SearchDomino Answers" document to download the database. Happy coding. Mat.
    15 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following