Jump to content
Developer Wiki and Function Reference Links ×

Worksheet - Comparing String values in a Database Row?


MaxStudio

Recommended Posts

Im creating a set of objects with the same plugin. The plugin has a user defined string parameter.

Lets say the string parameter is "name"

I create object1 and set the name parameter to "Red"

I create object2 and attempt to set the name parameter to "Red". I would like it to alert me that "Red" is already in use, give me the option to set it to something else, or allow me to override and continue to use "Red".

Is this possible?

Link to comment

Yes this is possible. There are several thing to consider.

- This functionality should be created via the PIO, and doesn't need to involve a worksheet.

- Do your check when IsNewCustomObject is TRUE. This will only be true when you are manually inserting a PIO for the first time. That will make sure the check doesn't happen on a regular regen and that you will only check and warn one object at a time.

- Use Count() to see if any other objects have the name field as the same

- Keep paramater and variable values separate. For example, start by setting obName:=PName to set your name variable to the parameter. If you need to change the name parameter, use SetRField(). The parameter won't update until another regen, so make sure to update and refer to obName for the rest of the script.

Hopefully, this will give you a start.

-Josh

Edited by JBenghiat
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...