Jump to content

«Set Field» to set specific values in checkbox set — how?


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

Recommended Posts

I have a Number field «Kontakttyp_enum». It contains multiple (!) number values, depending on what the user has deemed to select (see picture). It works great — numbers appearing and disappearing in this field, depending on which checkboxes are clicked upon.

Now, I’d like to set this field with the «Set Field» script step — but I can’t figure out how. I can read specific values (for example with the function «Position ( Kontakttyp_enum ; 6 ; 1 ; 1 )», but I don’t know how to add or remove a specific number.

Has anybody any insight on this?

It’s quite interesting. Even though it is a number field, the numbers seem to be delimited by Return characters (¶) — at least this is the way the field content is displayed on the layout. But when I insert a return-delimited list, the checkboxes break. For example, when I insert «1¶2¶3», no checkbox is crossed. And when I then click a checkbox, the same number is inserted again.

Thanks a lot for any hints!

Gary

Kontakttyp_enum.png

Link to comment
Share on other sites

First thing: a field formatted as a checkbox set should be defined as a Text field, not a Number field. As you have correctly observed, the field contains a return-delimited list of selected values.

Now, to add a new item to such field, you can do:

Set Field ( YourTable::YourField ; List ( YourTable::YourField ; "new item" ) 

(Note that this assumes the item is not already checked - otherwise it will be duplicated.)

 

1 hour ago, gczychi said:

when I insert «1¶2¶3», no checkbox is crossed.

I am afraid I don't follow this part. If setting the field to the text string "1¶2¶3" does not result in 3 checkboxes being crossed, then your value list is defined to use other values - hard to tell from your screenshot.

 

Edited by comment
Link to comment
Share on other sites

21 minutes ago, comment said:

First thing: a field formatted as a checkbox set should be defined as a Text field, not a Number field.

That did the trick! After I changed the field to text, everything works now as it should. And the problem inserting «1¶2¶3» was also related to the wrong field type.

Thanks a lot!

Link to comment
Share on other sites

This topic is 1628 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
×
×
  • Create New...

Important Information

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