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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why do you need a push button there ? you can't simply populate data of a text item into a push button.
caldernetAuthor Commented:
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

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

aa varchar(128);
while :system.last_record = 'False' loop
  aa := :d20re.tdnb_text;
  set_item_property('tdnb_push_button', label, aa);
end loop;
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

this will not work in this way: with SET_ITEM_PROPERTY you can set the labels only fpr ALL buttons (records) in the block ... and SET_ITEM_INSTANCE_PROPERTY doesn't support this also.

i think you have to do a workaround: change the buttons to unbound fields and give them visual attributes, so that they look like buttons.

in the POST-QUERY-trigger of your the detail block (D20RE) put

:D20RE.my_button_item := :d20re.tdnb_text;

to fire the "button", create a trigger code in WHEN-NEW-ITEM-INSTANCE ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Problem is, that you can't set the label of a button per instance, only for all buttons at one.

However, you may have a look at this link, it's probably what you want to do, but only with text instead of the icons.
caldernetAuthor Commented:
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 could make ENTER = mouse click ?

> Should the trigger not be WHEN-MOUSE-CLICK, rather than WHEN-NEW-
> ITEM-INSTANCE (which fires when the fields are loaded) ?

you may be right. didn't test it ;-)

> How do I make these fields "unbound" ? What would this accomplish?

sorry, should better say "no base table item" (properties: Database Item = No)

> Right now pressing ENTER when my new "button" has focus tabs me to the next could make ENTER = mouse click?

try KEY-NEXT-ITEM (field level) trigger and put your code there ...
Yes, I also think that the WHEN-MOUSE-CLICK-trigger is more useful in this case.

Maybe jwahl means with unbound that it is not attached to a database field.

KEY-NEXT-ITEM-trigger should catch the ENTER. You only have to make a call to the WHEN-MOUSE-CLICK-trigger there.
caldernetAuthor Commented:
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 ...
caldernetAuthor Commented:
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.


Bruce C.
caldernetAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.