Is there a reliable way to use the Split function to split records while also keeping track of the ID's in a consistent way. Every attempt at using this, the ID's get wonky and appear to do their own thing, but I'm sure it's just my lack of understanding how this really works. Illustration below:
//Attempting to split long strings divided by the '$' character
rec = [task longstrings]
(token, index) = split[text: longstrings by: "$"]
commit
rec.newshortstring += [#shortstring1 text:token ID:index] //first part of string after split
rec.newshortstring+= [#shortstring2 text:token ID:index + 2] //second part of string after split
This clearly doesn't work. The concept appears trivial to complete in c# but I can't wrap my head around it when working with the Split function and the way it handles indexes. What I'm trying to do is turn some text, for example: "first part $ second part" into two records with the tag #shortstring1 and #shortstring2 with the text equaling first part, second part respectively. and indexes 1 and 2.
What really happens is I get 50 different records with indexes going to 50 (I'm assuming because there are 50 total task records?). Is there a more efficient and consistent to ensure that you only get an index 1 and 2 each time you split a string in half.