Link to home
Start Free TrialLog in
Avatar of caldernet
caldernetFlag for Canada

asked on

How do I move text from a a detail field to a button label?

Oracle Forms - 10g

I have a working form with a standard header/detail one to many relationship. (Up to 4 detail lines are displayed at any one time.)

I would like to add push buttons to the detail section, displaying (in the label) text from another column from the details table. (After I'll do something when the button is pushed, but I won't worry about that now.)

I have been able to add a Text Item to the details and display the data from the new column there, but I want to be able to see this data on the push buttons. I assume I need to do one of the following:

A. Get the data to appear directly on the push buttons the way I can using the Display Item item.
B. Automatically copy the text from the Display Item fields to my push buttons.

Attached you will find a screen capture which I hope helps in the understanding of my problem.

Thank you.

FORM1.jpg
Avatar of Dr_Billy
Dr_Billy
Flag of Canada image

Why do you need a push button there ? you can't simply populate data of a text item into a push button.
Avatar of caldernet

ASKER

I am planning on having a push button open an associated attachment.
For now, I would like to simply populate data of a text item (TDNB_TEXT) into the label of my push button (TDNB_PUSH_BUTTON) but I simply don't know how to do it.

The following may be close but it gives me an error

FIRST_RECORD;
While :system.Last_Record <> 'TRUE' LOOP
    set_item_property(':d20re.TDNB_PUSH_BUTTON', label, :d20re.TDNB_TEXT);
NEXT_RECORD;
END LOOP;
_____ I put the following in the detail block's POST-QUERY trigger and it appears to do NOTHING.___
_____ It compiles OK ______________________________--

DECLARE
aa varchar(128);
BEGIN
while :system.last_record = 'False' loop
  aa := :d20re.tdnb_text;
  set_item_property('tdnb_push_button', label, aa);
  next_record;
end loop;
END;
ASKER CERTIFIED SOLUTION
Avatar of jwahl
jwahl
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For the moment, I'm testing jwahl's solution as it appears simpler. However...

- Should the trigger not be WHEN-MOUSE-CLICK, rather than WHEN-NEW-ITEM-INSTANCE (which fires when the fields are loaded) ?
- How do I make these fields "unbound" ? What would this accomplish?
- Right now pressing ENTER when my new "button" has focus tabs me to the next field...how could make ENTER = mouse click ?

Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks - I assume I still want to be Database Item = Yes, as I like the fact that the text on my "button" shows the data from the database automatically.

Please let me know why you think I might want to disconnect this field from database.

(I imagine I'll be assigning points for this question shortly.)
you have to set Database Item = Yes only if you want the data of the field to be stored in the database!
but in your case it's only a display item -  so set database item=no ...
When I set Database Item = No, I no longer see the contents of the field on the "button", so I'm setting it back to "Yes".

Setting Update Allowed = No will prevent anybody from changing the contents of this column.

Thanks.

Bruce C.
Actually, my button was set to "Text Item" - So I changed it to "Display Item" (so "Update Allowed" is no longer a parameter.)

I still have to have it set to Database Item = Yes or the text will not display.
Curiously, I have another Display Item with the Datatase Item set to No which does display that column's data.