Page 1 of 1

Refering to specific cells within a table

Posted: Sun Nov 22, 2009 8:04 pm
by cricketbird
How do I refer to an individual cell in a table? For example, I want to say something like:

Code: Select all

put line 3 column 2 of field "mytable" into field "mytextfield"
but, there is no column keyword and I can't find anything similar.

Thanks!
CB

Re: Refering to specific cells within a table

Posted: Sun Nov 22, 2009 8:14 pm
by malte
Do you use a datagrid or a table field?

Cheers,

Malte

Re: Refering to specific cells within a table

Posted: Sun Nov 22, 2009 8:15 pm
by sturgis
Use the item keyword instead. Since tables use tab as item delimiter make sure you set the delimiter in the handler where you will be addressing the item.

Code: Select all

set the itemdelimiter to tab

put "fred" into line 3 item 4 of field "myTableField"
Item delimiter is local, so theres no need to set it back to comma when done.

Re: Refering to specific cells within a table

Posted: Sun Nov 22, 2009 8:16 pm
by cricketbird
Table field. I'm using version 3.5. I just downloaded the free version of 4.0 Media, but none of these have the datagrid option.

Re: Refering to specific cells within a table

Posted: Sun Nov 22, 2009 8:18 pm
by cricketbird
Aha! The item keyword was the trick. Thank you!

Re: Refering to specific cells within a table

Posted: Fri May 28, 2010 8:54 pm
by Equiarch
I am brand new to Rev so please excuse my ignorance.

I have the same issue of wanting the user to enter info in a field that info is multiplied by a series of ratios and the products populate cell in a table

Code: Select all

 set the itemdelimiter to tab
put  field "freqField" *(81/80) into line 2 item 3  of field "intervalTableField"
I get this error, reffering to the second line of code: button "Button": compilation error at line 3 (Chunk: bad chunk order (must be small to large)) near "item", char 46

does anyone know where I am going wrong?

Cheers,
Mario

Re: Refering to specific cells within a table

Posted: Fri May 28, 2010 10:11 pm
by doc
No such thing as ignorance when you are just learning something new.... just new things yet unlearned. ;)

Give it a try this way:

Code: Select all

put  field "freqField" *(81/80) into item 3 of line 2 in field "intervalTableField"
HTH
-Doc-

Re: Refering to specific cells within a table

Posted: Sun May 30, 2010 7:53 pm
by Equiarch
Thank you Doc
That was the ticket.
One more question. How do I size the cells? I can't find anything in the user manuel.

Please help
Mario

Re: Refering to specific cells within a table

Posted: Mon May 31, 2010 9:18 pm
by Janschenkel
Look at the tabStops property - which you can also find in the 'Table' panel of the field property inspector.
Every entry is measured from the left of the table field, and the last width is repeated for the remainder of the columns. This may sound complicated, but it is not too hard and best explained with a few examples:
  • if you set it to "100", then all your columns will be 100 pixels wide.
  • if you set it to "100,150" then the first column will be 100 pixels wide, and the rest of the columns will be 50 pixels wide.
  • if you set it to "100,150,225" then the first column will be 100 pixels wide, the second 50 pixels, and the rest of the columns 75 pixels wide.
HTH,

Jan Schenkel.

Re: Refering to specific cells within a table

Posted: Wed Jun 02, 2010 8:31 am
by Equiarch
Thanks a million Jan!
I was wondering if anyone might know of a list of all the handlers, functions, and commands etc. because this code doesn't seem to work no matter where I put it.

Code: Select all

on start 
   put empty into card fld "freqField" 
end start 
Again please help!!!

Mario

Re: Refering to specific cells within a table

Posted: Wed Jun 02, 2010 9:19 am
by bn
Mario,
you dont specify card when referring to field since Rev does not have Card fields vs Background Fields like in Hypercard. In Rev you just refer to the field, optionally "of card "xxx" and again optionally "of stack "yyy" if you are not on that card/in that stack.

Code: Select all

on start 
   put empty into fld "freqField" 
end start
should do the trick if you are on the card the field is on.
regards
Bernd

Re: Refering to specific cells within a table

Posted: Wed Jun 02, 2010 5:10 pm
by Equiarch
Thanks BN for your response

But I already tried that and got this error referring to the line staring with on start: card "card id 1002": compilation error at line 1 (Handler: bad handler name (may be reserved word)) near "start", char 1.
I also tried this code in the script for the field its self and for the action button and got the same error:

Code: Select all

on load 
   put empty into field "freqField" 
end load
This is why I asked for a list as It seems load or start are not the correct handlers for this.

I am trying to make it so that every time the app starts up the entry field is empty

Thanks,
Mario

Re: Refering to specific cells within a table

Posted: Wed Jun 02, 2010 5:34 pm
by bn
Mario,
sorry, I did not pay attention to that. If you want to clear a field you could do that "on opencard".
You would put:

Code: Select all

on opencard
  put empty into field "freqField"
end opencard
into the script of the card the field is on.
Than everytime you open this card = go to this card the field will be reset.
Also, if this is the first card of your stack this card, will get an opencard message when you open the stack, thus clearing the field.
You might want to look up the message hierarchy in the user guide, the pdf that comes with Rev. Accessible from the Help Menu.

If you still have trouble with this please post.
regards
Bernd

Re: Refering to specific cells within a table

Posted: Thu Jun 03, 2010 5:27 pm
by Equiarch
bn wrote:Mario,
sorry, I did not pay attention to that. If you want to clear a field you could do that "on opencard".
You would put:

Code: Select all

on opencard
  put empty into field "freqField"
end opencard
into the script of the card the field is on.
Than everytime you open this card = go to this card the field will be reset.
Also, if this is the first card of your stack this card, will get an opencard message when you open the stack, thus clearing the field.
You might want to look up the message hierarchy in the user guide, the pdf that comes with Rev. Accessible from the Help Menu.

If you still have trouble with this please post.
regards
Bernd
Thanks Bernd

You have very helpful and are appriciated.

Peace!!!