?
Solved

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

Posted on 2008-11-17
12
Medium Priority
?
589 Views
Last Modified: 2013-12-19
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
0
Comment
Question by:caldernet
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 7

Expert Comment

by:Dr_Billy
ID: 22976331
Why do you need a push button there ? you can't simply populate data of a text item into a push button.
0
 
LVL 1

Author Comment

by:caldernet
ID: 22976412
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;
0
 
LVL 1

Author Comment

by:caldernet
ID: 22979306
_____ 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;
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 12

Accepted Solution

by:
jwahl earned 1700 total points
ID: 22982658
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 ...
0
 
LVL 9

Assisted Solution

by:MarkusId
MarkusId earned 300 total points
ID: 22982732
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.

http://www.tek-tips.com/viewthread.cfm?qid=547139
0
 
LVL 1

Author Comment

by:caldernet
ID: 22985453
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.
0
 
LVL 12

Assisted Solution

by:jwahl
jwahl earned 1700 total points
ID: 22985661
> 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 field...how could make ENTER = mouse click?

try KEY-NEXT-ITEM (field level) trigger and put your code there ...
0
 
LVL 9

Assisted Solution

by:MarkusId
MarkusId earned 300 total points
ID: 22985675
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.
0
 
LVL 1

Author Comment

by:caldernet
ID: 22985733
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.)
0
 
LVL 12

Expert Comment

by:jwahl
ID: 22985854
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 ...
0
 
LVL 1

Author Comment

by:caldernet
ID: 22985946
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.
0
 
LVL 1

Author Comment

by:caldernet
ID: 22986114
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.
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question