populate_list
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: populate_list

Hybrid View

  1. #1
    Join Date
    Jun 2001
    Posts
    109

    Question

    I created a record group using create_group_from_query built-in whcih populates a column, if I tried to create one more record group with a different query it gives me error sayin "populate_list:invalid column type for column 1 FRM41335" ....Can't I use the populate_list built in twice in a form?How do u create 2 record groups(i.e 2 different query to populate 2 list item dynamically)using create_group_from_query builtin in the same trigger(when_new_form_instance).

    The code goes like this...


    DECLARE
    QUERY RECORDGROUP;
    QUERY_OK NUMBER;

    BEGIN

    QUERY:=CREATE_GROUP_FROM_QUERY('pay_date',
    'SELECT pw_payin_date, pw_payin_date INTO
    :FRM2.pw_payin_date FROM payin_withdrawal');
    QUERY_OK:=POPULATE_GROUP(QUERY);
    IF QUERY_OK <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('FRM2.PW_payin_date');
    POPULATE_LIST('FRM2.PW_payin_date',QUERY);
    END IF;

    END;

  2. #2
    Join Date
    Aug 2000
    Posts
    462
    Could you please post ALL the code, and the exact error message. You can create multiple groups, in the same trigger.
    Oracle DBA and Developer

  3. #3
    Join Date
    Jun 2001
    Posts
    109
    1st rgroup to populate pw_rev_acct_code.....This I wrote a form level(when_new_form_instance(W_N_F_I))

    DECLARE
    QUERY1 RECORDGROUP;
    QUERY_OK1 NUMBER;
    --QUERY_OK2 NUMBER;
    --QUERY2 RECORDGROUP;
    BEGIN

    QUERY1:=CREATE_GROUP_FROM_QUERY('rev_acct',
    'SELECT distinct pw_rev_acct_code, pw_rev_Acct_code INTO
    :FRM1.pw_rev_acct_code FROM payin_withdrawal');
    QUERY_OK1:=POPULATE_GROUP(QUERY1);
    IF QUERY_OK1 <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('FRM1.PW_rev_acct_code');
    POPULATE_LIST('FRM1.PW_rev_acct_code',QUERY1);
    END IF;

    end;

    I want a second record group which populates the pw_dates in another block int he same form...if I wrote this code in the W_N_F_I trigger, it gave me error..so I wrote in when_new_item_instance trigger at item level on the item I want to populate list...This the code...

    2nd rgroup which populates the pw_payin_dates with a different query....

    DECLARE
    QUERY RECORDGROUP;
    QUERY_OK NUMBER;
    --QUERY_OK2 NUMBER;
    --QUERY2 RECORDGROUP;
    BEGIN

    QUERY:=CREATE_GROUP_FROM_QUERY('pay_date',
    'SELECT pw_payin_date, pw_payin_date INTO
    :FRM2.pw_payin_date FROM payin_withdrawal');
    QUERY_OK:=POPULATE_GROUP(QUERY);
    IF QUERY_OK <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('FRM2.PW_payin_date');
    POPULATE_LIST('FRM2.PW_payin_date',QUERY);
    END IF;

    END;


    How can I write the same code in W_N_F_I trigger, whcih populates two different items in 2 different blocks...

  4. #4
    Join Date
    Aug 2000
    Posts
    462
    I'll help you with this. Unfortunately, It will have to wait until this evening (about 6 hours from now).

    Sorry for the delay. I'll help ASAP.

    Oracle DBA and Developer

  5. #5
    Join Date
    Jun 2001
    Posts
    109
    That's okay, I can wait if I am getting help for 2-6hrs....:-) :-)

    Thanks
    Saritha

  6. #6
    Join Date
    Aug 2000
    Posts
    462
    DECLARE
    Q1 RECORDGROUP;
    Q1_OK NUMBER;
    Q2_OK NUMBER;
    Q2 RECORDGROUP;
    BEGIN
    Q1:=CREATE_GROUP_FROM_QUERY('pay_date',
    'SELECT a, a from t1');
    Q1_OK:=POPULATE_GROUP(Q1);
    IF Q1_OK <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('list_t1');
    POPULATE_LIST('list_t1',Q1);
    END IF;

    add_list_element('list_t1',1,'Select a value . . .','Select a value . . .');
    :control_block.list_t1 := 'Select a value . . .';

    Q2:=CREATE_GROUP_FROM_QUERY('pay_dates',
    'SELECT a, a from t2');
    Q2_OK:=POPULATE_GROUP(Q2);
    IF Q2_OK <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('list_t2');
    POPULATE_LIST('list_t2',Q2);
    END IF;

    add_list_element('list_t2',1,'Select a value . . .','Select a value . . .');
    :control_block.list_t2 := 'Select a value . . .';

    END;
    Oracle DBA and Developer

  7. #7
    Join Date
    Jun 2001
    Posts
    109
    Hi kmesser,
    Thanks for your help , but Ialready tried that but it didn't work....it was populating 1st query but not 2nd query...

    this is what I wrote....I don't need to add elements into list dynamically....

    DECLARE
    QUERY1 RECORDGROUP;
    QUERY_OK1 NUMBER;
    QUERY_OK2 NUMBER;
    QUERY2 RECORDGROUP;
    BEGIN

    QUERY1:=CREATE_GROUP_FROM_QUERY('rev_acct',
    'SELECT distinct pw_rev_acct_code, pw_rev_Acct_code INTO
    :FRM1.pw_rev_acct_code FROM payin_withdrawal');
    QUERY_OK1:=POPULATE_GROUP(QUERY1);
    IF QUERY_OK1 <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('FRM1.PW_rev_acct_code');
    POPULATE_LIST('FRM1.PW_rev_acct_code',QUERY1);
    END IF;

    QUERY2:=CREATE_GROUP_FROM_QUERY('pay_date',
    'SELECT pw_payin_date, pw_payin_date INTO
    :FRM2.pw_payin_date FROM payin_withdrawal');
    QUERY_OK2:=POPULATE_GROUP(QUERY2);
    IF QUERY_OK2 <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('FRM2.pw_payin_date');
    POPULATE_LIST('FRM2.PW_payin_date',QUERY2);
    END IF;

    END;

    FRM1, FRm2 are 2 different block in same form...
    its the same table for these 2 forms.....
    Let me know whats wrong in the above code.....

    Thanks
    saritha



  8. #8
    Join Date
    Aug 2000
    Posts
    462
    The problem is that you can't select two values into one variable, and you can't use an INTO clause in the query. In that way alone, both queries are invalid.

    The example I gave you does work, but here's one where both lists are in different blocks, on the same form, querying the same table and it works:

    DECLARE
    QUERY1 RECORDGROUP;
    QUERY_OK1 NUMBER;
    QUERY_OK2 NUMBER;
    QUERY2 RECORDGROUP;
    BEGIN

    QUERY1:=CREATE_GROUP_FROM_QUERY('q1',
    'SELECT a, a FROM temp');
    QUERY_OK1:=POPULATE_GROUP(QUERY1);
    IF QUERY_OK1 <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('block1.list1');
    POPULATE_LIST('block1.list1',QUERY1);
    END IF;

    QUERY2:=CREATE_GROUP_FROM_QUERY('q2',
    'SELECT a, a FROM temp');
    QUERY_OK2:=POPULATE_GROUP(QUERY2);
    IF QUERY_OK2 <>0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    CLEAR_LIST('block2.list2');
    POPULATE_LIST('block2.list2',QUERY2);
    END IF;

    END;
    Oracle DBA and Developer

  9. #9
    Join Date
    Aug 2000
    Posts
    462
    Did you get it working? How?
    Oracle DBA and Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width