Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Prune from a List in Formula Language

Posted on 2002-03-06
10
Medium Priority
?
3,702 Views
Last Modified: 2013-12-18
In Lotus Notes Formula Language, we need to code a formula which removes 1 item from anyplace in the list, where the list is userids.

As pseudo code it would read: If USER1 is part of LIST, then remove USER1 from LIST and leave all the other userids.

Example: Given the list: "john smith/miami/abc, james williams/tampa/abc, bill jones/boston/abc, mary bock/phoenix/abc" , and given that USER1 = bill jones/boston/abc, then remove bill jones/boston/abc from LIST.

Does anyone know a Lotus Notes Formula Language to do that removal?  
0
Comment
Question by:blyons48
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6844972
Here it is

List := "john smith/miami/abc, james williams/tampa/abc, bill jones/boston/abc, mary
bock/phoenix/abc" ;
USER1 := "bill jones/boston/abc";

@trim(@replace( @trim(@Explode(List;",")); User1; ""));


~Hemanth
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6846496
Close Hemanth, but what if the list isn't in a string like you provided, but in a multi-value field for example ?

Then the formula would be a bit more complicated :

Suppose you have a field called "List" that contains the list from which you want to remove the user, then this would be the formula:

ListString:=@Implode(List; ",");
User1:="bill jones/boston/abc";

@Explode(@ReplaceSubstring(ListString; User1+","; ""); ",");

The code explained :
The @Implode function will first combine all the list entries in one string and seperate them with a comma.
The @ReplaceSubstring, will remove the name and the seperation comma from the string.
The @Explode will then return the list as a list, minus the removed name.

Regards,
JM
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6847146
String is not provided by me, it is provide by blyons48, he din't mention it was a list. If it is a list then he don't have to convert it to the list, that extra step (explode) is not needed at all.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
David_Gordon earned 300 total points
ID: 6850472
Try this:

-------begin code----------

List:= (the name of your list field)
Value:= (name of field which contains the value to remove OR the literal string)

@if(@ismember(Value,List);"";@return(0)); 'if Value is not in List, then exit

Position:=@member(Value,List); 'gives position of Value in List

Newlist:=@subset(list,position-1):@subset(list,position-@elements(list)); ' concatenate all elements in List before Value with all elements in List after Value

-------end code-----------

Good luck

David
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6856870
Hm, my solution worked perfectly too. So why did you propose an answer and steel my points, David??
0
 

Expert Comment

by:David_Gordon
ID: 6858127
jerrith - Your solution was not complete. Choose a certifier with a comma, i.e. "Foobar, Inc." and run it through your script. I knew my code to be a full solution to both the current problem and any similar list-management problem as well as helping the questioner to understand the procedure, and therefore I felt it qualified to be proposed as an "answer". If you are sure of your solutions, propose them as answers so I do not mistake them for comments.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6858279
David,

You are right if I thought my answer was perfect I would have locked down. But as far as the rules of this forum, nobody locks the question as you did.

Blyons48,

Could you comment why my solution din't work for you ???
Before grading the points, ask the expert for clarification because nobody is on the same page as far as understanding of your problem.
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6859781
David,

Just FYI : We tend to never lock questions because :
- locking a question will remove the question from the attention of other experts, thus valuable input may never be given
- we leave it up to the person who asked the question to choose the correct answer. Sometimes for one question there are multiple answers and it's up to the asker to decide which answer suits him best.

As to your comment for my code not being perfect : If you read the question you'll see that it is intended for userids. Now do you know of anybody that uses a comma in userids ? Therefore it is not needed to complicate things by checking for things that will never happen, right?

I do however agree that your code was better, nevertheless I just wanted to point out to you that we don't usually lock questions.

Oh yeah, and it might not sound as such by my comments, but i was not offended or intended to offend anyone (my humour doesn't always get through to people) :-)

Blyons48,
It is common practice to provide an expert with feedback why you accept an answer and say at least thank you for your help.
Nothing as bad as not being appreciated for the work you do. (We are doing this for free to help you here, remember?)
0
 

Author Comment

by:blyons48
ID: 6861479
I hope I haven't started WWIII on EE.  When I went in yesterday to accept jerrith's answer, I found that David's newly posted answer was the only one that would allow me to click on accept.   So that's what I did.   While both may work, what's a body to do given only one choice?    Thank you all for your solutions, and please forgive me for only having one clickable choice.
0
 

Author Comment

by:blyons48
ID: 6861695
I hope I haven't started WWIII on EE.  When I went in yesterday to accept jerrith's answer, I found that David's newly posted answer was the only one that would allow me to click on accept.   So that's what I did.   While both may work, what's a body to do given only one choice?    Thank you all for your solutions, and please forgive me for only having one clickable choice.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question