Question concerning data

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

  • ArmellineArmelline Member, PRO Posts: 5,354

    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)

  • The GlessnerdThe Glessnerd Member Posts: 65

    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?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,159

    @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.

  • The GlessnerdThe Glessnerd Member Posts: 65

    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.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,159

    textSubStr("Hello", 2, 4) would result in "ell"

Sign In or Register to comment.