Grumman 0 Posted June 13, 2012 Report Share Posted June 13, 2012 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. Quote Link to post Share on other sites
warriorfullights 0 Posted June 14, 2012 Report Share Posted June 14, 2012 Will keep it noted. Great post and thanks for sharing. Might use it some day. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.