Jump to content

Set Field By Name


This topic is 4333 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Is it possible to use a script parameter containing the name of the field to be modified into the first parameter of the Set Field By Name step?

In other words I'd like to use the same Set Field By Name step to modify different fields by passing the name of the field to be modified into the script via a script parameter. It seems like this should be possible, but I'm not having any luck.

Thanks in advance.

Link to comment
Share on other sites

Hmm...so I'm no longer getting error 102, so it is finding the field, but its not seeming to modify it. I think now the second parameter needs a caress.

Set Field By Name[Get(ScriptParameter) ; Let( X = Get(ScriptParameter) ; Case (X= "N" or IsEmpty (X) ; "Y" ; "N"))]

The script parameter is being passed as: "CON__Contacts.tog::z_CourtesyCallFlag"

Link to comment
Share on other sites

Ungh....of course. I see the problem, but still am unsure about the solution.

I want to pass the name of the field to be modified into the script via the script parameter to be used in the first parameter of the Set Field By Name step.

The second parameter I want to be a calculation that checks to see if that same field's content is currently empty or "N" and if so to modify that same fields contents to "Y", but if that same field's contents are "Y" to change it to "N".

Essentially, the scirpt is supposed to just be toggling the contents of the field whose name is passed via the script parameter.

GetField(Get(ScriptParameter)) makes it work.

You have been so helpful many times in the past as well as this one. Thanks so much.

Link to comment
Share on other sites

Wouldn't it be simpler to make each field a button with a single SetField[] script step? Then you wouldn't need a script at all.

The way you have it now, you need to use:

GetField ( Get ( ScriptParameter ) )



to retrieve the field's contents. Note also that the smart way to define the parameter is =




GetFieldName ( YourTable::YourField )

This way you can rename the field without breaking the script.

Finally, it's best to use Number fields as status/flag fields. Use 1 for True, and 0 (or empty) for False. Toggle by setting the field to 'not the field'.

Link to comment
Share on other sites

This topic is 4333 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.