Page 1 of 1

Reference fields on other cards

Posted: Sun Nov 02, 2008 12:44 am
by tm1274
I am trying to use a combo box along with 3 option buttons to say something like this:

on mouseUp
if combobox "ComboBox1" is "2 Bottle" and
group "fillingmethod1" is "Bulk Fill Method" then put fld "fillingmethod2" of cd "fillingmethodcd2" of stack "data" into "fillingmethodvalue"
end if

But cannot get this to work. Can anyone tell me what I am doing wrong other than no experience?

Posted: Sun Nov 02, 2008 7:57 am
by Janschenkel
A combobox is a button, and to get its current content, you have to use the 'label' property ; and to get the hilited radio button in your radio button group, you have to use one of the 'hilitedButton' / 'hilitedButtonID' / 'hilitedButtonName' properties.
Also, what are you trying to put the text of field "fillingmethoçd2" into? If it is a local variable, then lose the quotes ; if it is the name of a field then don't forget the keyword 'field' or Revolution won't know where to put it.

Code: Select all

on mouseUp 
  if the label of button "ComboBox1" is "2 Bottle" and \
      the hilitedButtonName of group "fillingmethod1" is "Bulk Fill Method" then
    put fld "fillingmethod2" of cd "fillingmethodcd2" of stack "data" into field "fillingmethodvalue" 
  end if
end mouseUp

Posted: Sun Nov 02, 2008 8:51 pm
by tm1274
Thanks for the response but I must be doing something wrong.

Here's what I have. I have 1 Combo Box on the main stack called "ComboBox1", I also have a group of 3 Radio buttons called "fillingmethod1", I also have a Text entry field on a second card called "fillingmethod2", and lastly I have another Text entry field on my main stack called "fillingmethodvalue"

I have been trying for 2 days now to get the text from the second card field "fillingmethod2" (which I would pre-enter a value into) to input into the main stack field called "fillingmethodvalue" if "Combobox1" = "2 Bottle" and the group of radio buttons called "fillingmethod1" = "Bulk Fill Method".

Posted: Mon Nov 03, 2008 7:20 am
by Janschenkel
The script that I gave you earlier should do the trick. You can always do some light 'debugging' to figure out why it's not fetching the data:

Code: Select all

on mouseUp
  answer "Combobox1:" && the label of button "ComboBox1" & return & \
      "FillingMethod1:" && the hilitedButtonName of group "fillingmethod1"
  if the label of button "ComboBox1" is "2 Bottle" and \ 
      the hilitedButtonName of group "fillingmethod1" is "Bulk Fill Method" then 
    put fld "fillingmethod2" of cd "fillingmethodcd2" of stack "data" into field "fillingmethodvalue" 
  end if 
end mouseUp
This way, when you click the button it should tell you the respective values.

If you really can't find the solution, send me your email address via private message, and I'll email you my test stack to take apart.

HTH,

Jan Schenkel.