Home » Developer & Programmer » Forms » Updating values in a details block
Updating values in a details block [message #142151] Thu, 13 October 2005 11:02 Go to next message
ducrot
Messages: 3
Registered: October 2005
Junior Member
Hi,

First, excuse my poor english.

I work with Forms 5.

I have a form with a master block and a details blocks.

In the details block, the values of some fields are obtained by calculation using the value of a field, say F, in the master block. All works fine.

But, I don't know how to update the calculated values of all the records of the details block when I modify the value of F in the master block. In the When-validate-item trigger associated to F, it's impossible to use a GO_BLOCK(details block) and it seems impossible to execute the on-populate-details trigger because that trigger calls GO_BLOCK.

Thank you by advance to people who can help me.

Ducrot
Re: Updating values in a details block [message #142190 is a reply to message #142151] Thu, 13 October 2005 13:11 Go to previous messageGo to next message
feroze
Messages: 144
Registered: September 2005
Location: chicago
Senior Member
Hi

Your calculated fields in detail block is it non database item.
Use formula in detail block item properties either write a trigger on post_text_item of F field in master block to do a calculation or else in the properties of details field write the formula.

Yes GO_BLOCK is restricted in when_validate_item trigger.

Let us know how it works

Regards

Re: Updating values in a details block [message #142196 is a reply to message #142190] Thu, 13 October 2005 13:46 Go to previous messageGo to next message
ducrot
Messages: 3
Registered: October 2005
Junior Member
Hi feroze,

Thank you for your answer. Unfortunately, it doesn't work.

My calculated fields in details block are database items.

If I put a calculation in the when_validate_field (or post-text-item) of F field in the master block that affects a details block field, the result of the calculation appears only in the first record of the details field.

It's why I tried (without success) to use on-populate-details trigger.

When you propose to "use formula in detail block item properties" or "in the properties of details field", I don't understand where I ought to write the formula.

GO_BLOCK is also restricted in post_text_item trigger.

Ducrot
Re: Updating values in a details block [message #142200 is a reply to message #142196] Thu, 13 October 2005 13:57 Go to previous messageGo to next message
feroze
Messages: 144
Registered: September 2005
Location: chicago
Senior Member
Hi

Sorry it didn't work,Thing is i don't have forms and reports installed so couldn't check it,Just assuming and trying to help out.

Why you are getting the result only in first record of detail block you should get in all the detail records,try to bring the cursor in detail block and see all the records .
where did you put the calculation formula in detail or master block field,

or else write the trigger when_new_item_instance in detail block level and write your formula in that trigger :detail_block.field := :master F + something + ..

After the last field in master block write trigger
key_next_time go_item(:detail_block.field name)..

Let's try like this..
Re: Updating values in a details block [message #142233 is a reply to message #142200] Thu, 13 October 2005 20:32 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
How about putting a button next to the 'F' field, label it 'Update', and in the when-button-pressed trigger have an 'update' statement which will change the records in the database, then go_block to details and do an execute_query, then go 'somewhere else' ?'F' field?, ?button?, where-ever.

David
Re: Updating values in a details block [message #142412 is a reply to message #142233] Fri, 14 October 2005 08:43 Go to previous message
ducrot
Messages: 3
Registered: October 2005
Junior Member
Hi gang,

Finally, I have found a solution inspired by your answer and by feroze's one.

I have developped a key-next-field (and key-previous-field) trigger associated with the master block F field. In that trigger, if the value of F has changed, I goes to the details block, makes the calculation for every records in a loop, goes up to the first record and returned to the master block.

Thank you for having taken time to answer to to my problem

Ducrot
Previous Topic: mime type of a blob column
Next Topic: capture Oracle user name from Forms App
Goto Forum:
  


Current Time: Fri Sep 20 00:38:03 CDT 2024