Welcome Guest

Pages: 1
Add option to List Contains Test function to save the index to a variable.
cpkPostMarch 16, 2015, 21:23
Advanced
Posts: 95
Registered:
March 1, 2015, 02:55
Normal topicAdd option to List Contains Test function to save the index to a variable.

The 'List Contains Test' function allows me to find out if the list contains something I maybe searching for and it will allow me to even delete it but it won't tell me what the index is in the list where the match was found. So, if I want to access the found item with 'List Item at Index' I can't because I don't know what the index is.

So, I would like to request an optional checkbox to enable saving the index to a variable and drop-down box to select the variable to save the index to.

I'm thinking this one should be pretty easy to implement since a search routine through a list would have an iterator that would also be the index assuming zero indexing throughout.

2MR2PostMarch 16, 2015, 21:39
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: Add option to List Contains Test function to save the index to a variable.

I'm a little curious how you would use this. I've written a lot of actions and the 'List Item at Index' function is typically used after an 'Index Of' function. It's not difficult to add the 'save index', I'm just curious as to the usage.

BTW: single line text fields will display blue if they contain a \n in the next release. 🙂

cpkPostMarch 16, 2015, 22:10
Advanced
Posts: 95
Registered:
March 1, 2015, 02:55
Normal topicRe: Add option to List Contains Test function to save the index to a variable.

ARRRG! I just typed a long answer and the forum had an error posting it! 🙁 Okay practice makes perfect I guess.

I wrote an action that iterates through all of the UDTI field names and changes the case to title case. However, there are some fields that I wanted to keep their case such as BARCODE, ASIN and VGMdb. So, in the beginning of the action I build an exceptions list and then prior to making any changes to the case of a field name I search the exceptions list for the name and only modify the name if not found. This worked fine but I decided it would even be nicer if it fixed naming of fields to match what is in the exceptions list. So, do a case insensitive search in the list and if a match is found then rename the field the UDTI field to match the case in the exceptions list if it doesn't already. I have not found a way yet to get the index of the match in the exceptions list. I could hard code the index since I know what they are since I am building the list at the start of the action however hard coding stuff like that is just asking for problems in the future if I add, delete, and/or reorder the build list functions. Does that make sense?

I know the upcoming version is going to have changes that would change the way I am going about writing many of my actions but in the mean time I'm just working with what I have and trying to figure work-arounds when possible.

2MR2PostMarch 16, 2015, 22:13
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicRe: Add option to List Contains Test function to save the index to a variable.

Okay makes sense. Almost done 🙂

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.015 seconds.