Question concerning data
The Glessnerd
Member Posts: 65
So say I have a table where each cell contains a 5 digit number (example 31476). Using a rule, can I reference a certain number within that number (4 for example) within the cell? If that makes sense
Comments
Yes, textSubStr.
textSubStr(tableCellValue(yourtable,row,col),start_char,end_char)
To get the 4th digit of a value held in a cell in row 2, column 3:
textSubStr(tableCellValue(yourtable,2,3),4,4)
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thank you, kind sir. Does it also work with strings where the numbers are separated by “,” of text in a cell, such as 4,3,6,7,8?
@The Glessnerd textSubStr will work with any text as along as you know the start and end character. It will not help you find all the comma positions though, if you are trying to be more flexible.
If you want to store a list of number but display in the game them with ",", then I suggest storing them in individual cells and then using tableMergeValues to get the comma separated string for display.
You could use textFind(tableCellValue(yourtable,2,3), ",", 1) which will find the first comma, but you'll may need to do that in a loop for every value, replace the last argument (1) with the result of textFind.
It’s all good. I already have the data separated into individual cells, was just curious to see if I could condense at all.
Also, for the textSubStr function, what exactly are start_char and end_char? Sorry, I haven’t had time to play around with it yet and won’t for several days.
textSubStr("Hello", 2, 4) would result in "ell"