Page 1 of 1
referring to a field that is part of a group
Posted: Fri Oct 10, 2008 10:57 am
by Alistair
This seems like a really basic question but I can't find an explanation anywhere: how does one refer to a field that is part of a group.
I have a number of text fields grouped and the group is then used as a background extending across several cards. I want to be able to read the contents of a specific field on a specific card and transfer the contents to a variable. Presumably it is not necessary to ungroup the fields, read the specific field and then regroup.
Posted: Fri Oct 10, 2008 11:28 am
by Klaus
Hi Alistair,
you already have the answer in your question:
Code: Select all
...
put fld "your field in a group here" of cd "whatever" into field_var
...
If you do not have several fields with the same name on a card (you would never do so, right?

) then you don't even need to specify the groups name.
Definitvely NO need to ungroup or other tricky procedures
Hope that helps.
Best
Klaus
Posted: Fri Oct 10, 2008 1:01 pm
by Janschenkel
If your field is part of a group woth backgroundbehaviour, you'll have to first 'go' to that specific card - otherwise you get the data from that same field as displayed on the
current card. Preferably wrap this 'go' inside a lock/unlock screen pair to avoid that the user sees the change in cards.
Code: Select all
on mouseUp
lock screen
go card 2
put field "Foobar" into tData
go back
unlock screen
answer tData
end mouseUp
HTH,
Jan Schenkel.
Posted: Fri Oct 10, 2008 1:09 pm
by Klaus
Sorry, Jan, but this is really not necessary!
You can simply do as I wrote in my first anwer:
Code: Select all
...
put fld "your field in a group WITH BG behaviour here" of cd "whatever" into field_var
...
Just tested and works

Posted: Sat Oct 11, 2008 6:38 am
by Janschenkel
Now I remember what my problem in this regard was - it was in the context of the 'value' function:
http://quality.runrev.com/qacenter/show_bug.cgi?id=1836
Anyway, carry on, nothing to see here - Klaus was right from the start and I was making things more complicated because of a corner case...
Jan Schenkel.
Posted: Sun Oct 12, 2008 2:33 am
by Alistair
Thanks for those tips. I have set up the cards with the same background and my script working perfectly. I tried a few possibilities before posting my message but didn't quite get the syntax right.