Array Evaluation and field value assignment

If a field named ‘rawCgiExtra’ has this value…
RR~2017-01-17 23:08:59~pos~0~pic~1~pump~0~sfc~1

will the following formula in a procedure put the text ‘0’ in a text field named ‘pos’? If not, why not?

pos = Array(rawCgiExtra,val(ArraySearch(rawCgiExtra,“pos”,1,"~")+1),"~")

It does - for rawCgiExtra and pos being either fields or variables. Why would you expect otherwise?

For yet to be understood reasons,

posText = array(cgiExtraParameters,3,"~")

works but

posText = Array(rawCgiExtra,val(ArraySearch(rawCgiExtra,“pos”,1,"~")),"~")

does not. I’ve been staring at this for too long and thought if I asked others, I’d be put out of my misery of overlooking something obvious. The 1st format works but I can not count on the order of each set of values so I was going to use the search method, but alas, it is not working.

I’m not thinking that it matters, but this is in a shared Enterprise database and these statements are in the procedure that is run when the record is added via the use of a url.

… and specific to the original post

pos = array(cgiExtraParameters,4,"~")

works, while

pos = Array(rawCgiExtra,val(ArraySearch(rawCgiExtra,“pos”,1,"~")+1),"~")

does not. The posText and the pos fields are both empty using the 2nd method.

I was going to suggest that you might have a variable called rawCgiExtra but I tried that and it still works. I have no experience of using Enterprise, so maybe the problem is there. Have you tried it in a non-enterprise d/b? Have you tried it with variables rather than fields? Have you tried it with different field/variable names?

I note that pos has become posText but that doesn’t change anything. I tried Pan X as well and it works there.

I don’t know why your formula isn’t working, I assume there is some critical missing piece of information you haven’t told us about because you don’t know it.

However, I have a suggestion. It seems to me that this formula would come up with the value you are looking for.

tagdata(rawCgiExtra+"~","~pos~","~",1)

I tested this, and it works for me. It seems like it is a simpler solution, also. If it doesn’t work, maybe the data in rawCgiExtra isn’t what you think it is.

Thanks.

I was confusing the automatically created variable ‘cgiExtraParameters’ with my field name ‘rawCgiExtra’ and I had not yet shoved the variable value into the field name at that point in the procedure (thus they could not be used interchangeably.) I hadn’t noticed that I was inconsistent in my use of the two items.

Plus, Jim’s suggestion to use TagData also was simpler and it fixed a new problem of searching for a ‘tag’ which did NOT exist in the cgiExtraParameters, so when I added 1 to the search result of 0 to get that missing tags’ parameter, I then erroneously got the first element in the text array. Using TagData properly retrieved nothing.

Robert Ameeti