@SetField on all documents in view

I want to set all documents in a view to Archive. I have:@SetField(“Archive”; “Yes”); @Command([ViewRefreshFields])

However, this is only updating 1 record. How do I update them all? What do I need to add to this code? Thanks!

Subject: @SetField on all documents in view

Your agent might be having “Target” property set to “All Selected Documents”. Instead select “All Documents in a View”.

This might be the reason. If not this then elaborate the development and execution steps you followed in more details.

-Ravi.

Subject: RE: @SetField on all documents in view

Hi Ravi - This is in a button on the form, I have the button calling the macro with the code:

@SetField(“Archive”; “Yes”);

@Command([ViewRefreshFields])

When setting the Target to All Selected Documents, I got the error that @Commands can’t be used in this way and to set my Target to None. However, that only allows me to set one document at a time.

Subject: RE: @SetField on all documents in view

Why do you have an @Command in there? Why not just set the field? Then you can run on selected documents.

Subject: RE: @SetField on all documents in view

The value must be the same data type as the field; for example, if the field is numeric, the value must be a number.

Subject: RE: @SetField on all documents in view

I think we can assume the value “Yes” is a string.

Subject: RE: @SetField on all documents in view

Ok, I apologize, but I am being very stupid today! I have the macro and am trying to just say Field:=Archive = “Yes”, but it isn’t liking this. Can someone give me the code to just set this field to Yes? Thanks much!

Subject: RE: @SetField on all documents in view

FIELD Archive := “Yes”;@True

The @True doesn’t do anything, but there’s a rule in Formula Language that the last line of any formula must be a value or a selection statement. In this case, you don’t want to take a chance on changing the selections that have been made (SELECT @All is a normal terminal statement, but there’s always a chance that some dot version of Notes might take the statement literally, so it’s best to avoid a selection statement if you don’t need one).