If I wanted to set the text of a Label field to something that is in a basic table how would I do it?
My table (TextTable) is set up as such (tab delimited)
1 Choice1
2 Choice2
3 Choice3
4 Choice4
5 Choice5
If I wanted JUST key # 4 (Choice4) how would I query the table by the key to pull the "text" part that I wanted to set the label field (labeltext) to?
Thanks in advance.
Pulling a row from a table
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Pulling a row from a table
Hi.
The trick is to parse your data. You surely already know instinctively that to get the line of interest, you would:
But to get just the second part of line 4, you need to parse at the line level. Is your data separated by spaces? That is, are there two words in that line? If so:
If the two parts are separated (delimited) by a tab character, as you say, you would have to go to the dictionary and look up the "itemDelimiter", play around with the examples there, and write back with the two-liner that will do what you want to.
Craig Newman
The trick is to parse your data. You surely already know instinctively that to get the line of interest, you would:
Code: Select all
answer line 4 of fld "yourTableField"
Code: Select all
answer word 2 of line 4 of fld "yourTableField"
Craig Newman
Re: Pulling a row from a table
Ok so if I wanted to get column 3 row 3 of a table
set itemdelimter to tab
put column 3 of line 3 of field "TextTable" into field "DialogText"
Would that work? Or something similar? I'm very new to this.
thanks in advance.
set itemdelimter to tab
put column 3 of line 3 of field "TextTable" into field "DialogText"
Would that work? Or something similar? I'm very new to this.
thanks in advance.
Re: Pulling a row from a table
Hi.
Your thinking is correct, but not your syntax. When you set the itemDelimiter, you are talking about items, a class of chunk similar to lines, words, and characters. Each of these is delimited by specific characters, for example, lines are delimited by returns.
You would:
put item 3 of line 3 of field "TextTable" into field "DialogText"
So you need practice, which is normal.
Craig
Your thinking is correct, but not your syntax. When you set the itemDelimiter, you are talking about items, a class of chunk similar to lines, words, and characters. Each of these is delimited by specific characters, for example, lines are delimited by returns.
You would:
put item 3 of line 3 of field "TextTable" into field "DialogText"
So you need practice, which is normal.
Craig