@Member Function for a list of attachments

285 pts.
Tags:
Domino 6.5
Domino Designer
I'm attempting to determine if the filename of an attachment is contained in a list. Here is the code (from a view column): fileName:=$name; //from a programmatic column name imgTitle:=""; listOfNames := @Explode(@AttachmentNames); @If(@IsMember(listOfNames;fileName);imgTitle := fileName;imgTitle:="Nada!"); newList:= @Implode(@AttachmentNames); posNum:= @Member(fileName;newList); posNum The code should find the filename according to the $name variable, match it from the list of filenames and assign it, then, display what position (number) it is in the file list. (e.g. is it the first, fourth, etc..) I want to use this info later to assign a caption box to it. When I try this code, all I get are zero's (0). Any thoughts? Thanks -mrg.

Answer Wiki

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

@Member will do it all for you in a more compact manner. Your code could be changed to:

posNum := @Member(fileName; @AttachmentNames);

imgTitle := @If(posNum = 0;
“Nada!”;
fileName);

imgTitle

I’m assuming that the variable fileName is valid here.

If fileName is a member of @AttachmentNames (which is a list…you don’t have to @Explode it), then @Member returns the number within the list, or else it returns 0. The reason why you were getting all 0′s is because you @Implode(d) the list of @AttachmentNames translating it from a list to a string.

Hope this helps.

Discuss This Question: 1  Reply

 
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
  • Mrg
    True that does work, and actually it improves some other code that I had used before. Although my purpose is to find out which (position) number it is in the list. (i.e. which attachment it is it?) Is it the first, the second, the fifth? Then if it returns a value of '2', I could then match it up with something like: caption:= PhotoCaption + posNum; (PhotoCaption2) @Do("<strong>" + caption; + "</strong>") Cheers -mrg.
    285 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