This discussion is archived
3 Replies Latest reply: Mar 19, 2013 7:04 AM by CraigB RSS

Retreiving the item props on requerying set at the time of creating a rec

951614 Newbie
Currently Being Moderated
Hi ,

I have developed a custom form wherein there are 2 data blocks. One is a single record header datablock(DB1) and the other one is multi record lines datablock(DB2).
DB1- DB2 share a master-detail relationship with DB1 being the master and DB2 being the detail block.

While creating a record in the header block and corresponding records in the lines block, based on a value in a field in the DB2, some other fields in the same block (DB2) get greyed out. After saving the form an id is generated in the header block.

When I re-query for this particular id, those fields which were supposed to appear greyed out , appear enabled.

I tried setting the same item properties in the KEY-EXEQRY trigger at the DB1 as well as DB2 level, but it did not work.

/
-- KEY-EXEQRY of DB1

GO_BLOCK (DB1);
EXECUTE_QUERY;

<Condtion>
<set of item props>
<end of condition>

/

Please let me know if this is the correct trigger to achieve what is required.

Appreciate any help on this.

TIA
-SR
  • 1. Re: Retreiving the item props on requerying set at the time of creating a rec
    951614 Newbie
    Currently Being Moderated
    Following is the logic in multi record block of the child

    Text Items 1 , 2,3 , 4 etc

    Based on the value of item1 , item 2 ,3, 4 etc are either insert allowed or update allowed.
    This is achieved by using the set_item_instance_property on the when validate item of item (Enabling the insert allowed or updated allowed as needed)

    Now, when we query back the record, this change is not taking effect.

    Wondering if the same logic at when validate item level is repeted at KEY_EXEQRY of the header block as mentioned in the initial post..will it work

    Thanks
    Regards
    SR
  • 2. Re: Retreiving the item props on requerying set at the time of creating a rec
    951614 Newbie
    Currently Being Moderated
    Correction - This is achieved by using the set_item_instance_property on the when validate item of item 1
  • 3. Re: Retreiving the item props on requerying set at the time of creating a rec
    CraigB Guru
    Currently Being Moderated
    Please let me know if this is the correct trigger to achieve what is required.
    I would use the DB2 Post-Query (PQ) trigger instead of the Key-Exeqry trigger. In the Key-Exeqry - you are probably looping through your DB2 block and evaluating each record. By moving the code to the DB2 PQ trigger - you don't have to loop through your block as the PQ trigger fires for each record displayed in the block. This is more efficient that looping through your block and it will allow you to encapsulate your validation/enabling logic (see comment below) so you can write your validation/enabling logic once and reuse it.
    Based on the value of item1 , item 2 ,3, 4 etc are either insert allowed or update allowed.
    This is achieved by using the set_item_instance_property on the when validate item of item (Enabling the insert allowed or updated allowed as needed) >
    I assume that this is where the logic is that enables/disables insert/update as you are creating records in DB2.
    Wondering if the same logic at when validate item level is repeted at KEY_EXEQRY of the header block as mentioned in the initial post..will it work
    Don't repeat the logic! Instead, I suggest you create a Forms Program Unit (Procedure) and move your logic from the When-Validate-Item to the Procedure. Then call your Procedure from your When-Validate-Item and your Post-Query triggers.

    Hope this helps.
    Craig...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points