Link to home
Start Free TrialLog in
Avatar of tashsmith
tashsmith

asked on

Agent using formula to simply find and replace from list on multiple docs

Hi guys,

I have a categorised view
I want to allow users to select some docs and find and replace values in a field.
the field is a list and may contain one or more values.

so

select one or  more documents
hit action button
presented with list, lookup from view in same database
select one or cancel
presented with a 'change to' pop up string box
make change
do not allo more than 10 documents at one time (if possible)
do not present box for each document



I have so far this
FIELD AFIELD:= AFIELD;
list:=@Prompt([OkCancelListMult] ; "Select "; "choose" ; "" ; LOOKUP FROM VIEW; "" );
choice:=ALLOW USER TO TYPE;
x := AFIELD;
y := @Replace(x; list;choice);
z := @Trim(y);
@SetField("AFIELD"; z);
SELECT @All

Avatar of olaraak
olaraak
Flag of Estonia image

It should work.
Did I get it right, you want to get keyword list from view lookup and then let user to replace some of the values?

In this case, multi selection is not the best option, of course, option "OkCancelList" should be better. Unless you need to replace multiple choices with one.
Then we must clear resulting list from duplicate values using  @Unique.

Agent target should be "All selected documents".

You can simplify code, specifying just:
myList:=@Prompt([OkCancelList] ; "Select "; "choose" ; "" ; LOOKUP FROM VIEW; "" );
myChoice:= @Trim(ALLOW USER TO TYPE);
FIELD AFIELD:= @Trim(@Replace(AFIELD; myList; myChoice));

Open in new window

Try this.
Create new action on your categorized view, choose Lotus Script, go to Options section of the action's code, right click and choose Import, select the file codeEE.txt, choose yes if prompted to replace existing code...

Haven't tested it, post away if something is wrong...

Hope this helps,
mb¤
codeEE.txt
Avatar of tashsmith
tashsmith

ASKER

Hi guys,

Thanks for that, gotta run, will test and post back tomorrow:-)
Hi mbonaci:

I have tried your solution first as it appears to cater for more of my requirements, thanks.

On running the agent, nothing seems to be happening.

I have replaced the field and view names as requested in the markup.

There is no prompts and when the debugger is running it isnt evoking or stepping throuhg anything?
ASKER CERTIFIED SOLUTION
Avatar of mbonaci
mbonaci
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This works perfectly, and the instructions were concise, accurate and easy to follow.

Thanks very much