Jump to content
UBot Underground

Pesky State Dropdowns Fixed!


Recommended Posts

Hey all. Not sure how many people will use this, but I know when I searched through the forum for answers on this I couldn't find one and so when I finally figured out a way to do it, I thought I'd share it here in case someone else was looking for a way to do this in the future.

 

When filling out forms, I was encountering state field dropdowns that were either formatted like "NY" "New York" or "NY - New York". I didn't want to have to change all my data over to fit the different sites, so I came up with this:

 

The data in your cells should be formatted like "NY - New York" If it's a site that needs "NY" or "NY - New York" then you're all set, your code should look like this:

 

change dropdown((<state dropdown>, 0), ($table cell(&sampletable, 0, 5))

 

If it needs the "New York" then your code should look like this:

 

change dropdown((<state dropdown>, 0), $substring($table cell(&sampletable, 0, 5), 5, $subtract($text length($table cell(&sampletable, 0, 5)), 5)))

 

Because the shortest state is Ohio, 4 characters, and you need at least 7 characters to distinguish North Carolina from North Dakota for example, there's no way to take just a normal substring to exclude the "NY - " at the beginning. So you have to take the text length of the cell and subtract the number of characters that "NY - " takes up.

 

I hope this is of use to someone, it's had me stuck for a few hours.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...