This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Dec 13, 2012 1:51 AM by only.ashish99 RSS

Calling form with value problem

only.ashish99 Newbie
Currently Being Moderated
Hello All,

Platform: forms 6i

calling form- quot.fmx
called form- inv.fmx

Value to pass: ref_no

on Calling form-> button-> when-button-pressed-trigger
DECLARE
P PARAMlist;
BEGIN
P:= CREATE_PARAMETER_LIST('ABC');
ADD_PARAMETER(P,'A_REF_NO',TEXT_PARAMETER,:ref_no);
CALL_FORM('D:\clean\inv.FMX',NO_HIDE,NO_REPLACE,NO_QUERY_ONLY,P);
DESTROY_PARAMETER_LIST(P);
END;
On Called form-> Parameter created-> a_ref_no

when-new-block-instance trigger
SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no:='||:PARAMETER.A_REF_NO);
EXECUTE_QUERY;
When i am clicking om button form is opening but no value in inv.ref

Please help.
  • 1. Re: Calling form with value problem
    CraigB Guru
    Currently Being Moderated
    Are you sure you have a value in the "QUOT.fmx" :REF_NO before you call the INV.fmx form?

    Craig...
  • 2. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    Yes I am sure about that.
  • 3. Re: Calling form with value problem
    Prabodh Guru
    Currently Being Moderated
    when-new-block-instance trigger
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no:='||:PARAMETER.A_REF_NO);
    EXECUTE_QUERY;
    When i am clicking om button form is opening but no value in inv.ref>
    What is not clear is the when-new-block-instance trigger is on which block? I hope it is not the INV block.
    Quoting from the documentation
    Description
    Fires when the input focus moves to an item in a different block. <b>Specifically, it fires after navigation to
    an item</b>, when Form Builder is ready to accept input in a block that is different than the block that
    previously had the input focus. >

    Try moving the code to WHEN-NEW-FORM-INSTANCE.
  • 4. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    Thanks Prabodh for replying.

    I tried this now but no luck. Any other thing you can advise me.

    Form is opening without any error and without any value.
  • 5. Re: Calling form with value problem
    Andreas Weiden Guru
    Currently Being Moderated
    Put a message in your code to check the value of REF_NO and your parameter.
  • 6. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    i checked like this
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,000001);
    EXECUTE_QUERY;
    Also tried by setting parameter initial value to 000001
    but no luck
  • 7. Re: Calling form with value problem
    CraigB Guru
    Currently Being Moderated
    Your syntax is wrong!
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no:='||:PARAMETER.A_REF_NO);
    You are using an assignment operator instead of a comparison operator. Your code should be:
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no ='||:PARAMETER.A_REF_NO);
    In you last example, your value of REF_NO is obviously a VARCHAR2 so you need to enclose the value in quotes. Also, you didn't include the comparison operator.
     SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,000001); 
    It should be:
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no = '''000001'''');
    Hope this helps.

    Craig...
  • 8. Re: Calling form with value problem
    user346369 Expert
    Currently Being Moderated
    I think this would also work:
    SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ref_no = :PARAMETER.A_REF_NO');
    For that matter, why not just set the where clause of the INV block in the Forms Builder:
    ref_no = :PARAMETER.A_REF_NO
  • 9. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    still blank craig.

    ref_no datatype is number and we are creating text_parameter. Is this creating problem?

    btw i changed datatype also in parameter property but no luck.

    Any other suggestion.
  • 10. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    I tried with this also Steve.

    And wht do you mean by where clause in forms? are you talking about

    data block------properties-----------Query data source type------ From clause query------------ (WHERE ref_no=:PARAMETER.A_REF_NO)

    I tried this also.
  • 11. Re: Calling form with value problem
    KhaledFarouk Explorer
    Currently Being Moderated
    Hello
    let's try some steps

    1- at the when-new-form trigger message('REF_NO=':PARAMETER.A_REF_NO);message('REF_NO=':PARAMETER.A_REF_NO);
    this step to check the value of PARAMETER.A_REF_NO
    if it's not null then

    2- data block------properties-----------Query data source type------ From clause query------------ (WHERE ref_no=:PARAMETER.A_REF_NO)
    and check what happened if not workink try to enter static value at (WHERE ref_no=220)
    also check if the ref_no is number or char

    3- at the pre-form trigger
    ' :PARAMETER.A_REF_NO := 30;

    4- as mr CraigB said change the code to be at ( pre_form) or (when_new_form) or (when_new_block) triggers
    ' SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ITEM_id='||:PARAMETER.A_REF_NO);
    not
    ' SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ITEM_id:='||:PARAMETER.A_REF_NO); this code is wrong


    that may work

    Respectfully
    Khaled Farouk
  • 12. Re: Calling form with value problem
    only.ashish99 Newbie
    Currently Being Moderated
    Hi Khaled,

    Thanks for ur time.

    1- at the when-new-form trigger message('REF_NO=':PARAMETER.A_REF_NO);

    This is successful. Message is coming with value.

    2- data block------properties-----------Query data source type------ From clause query------------ (WHERE ref_no=:PARAMETER.A_REF_NO) No result

    enter static value at (WHERE ref_no=220) No result

    also check if the ref_no is number or char: Number

    3- at the pre-form trigger
    ' :PARAMETER.A_REF_NO := 30; Showing message REF_NO=30 not in ref_no field

    4- as mr CraigB said change the code to be at ( pre_form) or (when_new_form) or (when_new_block) triggers
    ' SET_BLOCK_PROPERTY('inv',DEFAULT_WHERE,'ITEM_id='||:PARAMETER.A_REF_NO);

    I tried this also on when-new-form
  • 13. Re: Calling form with value problem
    KhaledFarouk Explorer
    Currently Being Moderated
    Hello

    1- at the when-new-form trigger message('REF_NO=':PARAMETER.A_REF_NO);

    This is successful. Message is coming with value. that seems good the parameter is returning data.


    2- the mean of : enter static value at (WHERE ref_no=220) No result
    is to enter the value which appeared in the message message('REF_NO=':PARAMETER.A_REF_NO);
    for example if the message appeared ref_no=50
    so we do like
    data block------properties-----------Query data source type------ From clause query------------ (WHERE ref_no=50) check the result

    try to do this step again and tell me the answer.

    Respectfully
    Khaled Farouk
  • 14. Re: Calling form with value problem
    CraigB Guru
    Currently Being Moderated
    ref_no datatype is number and we are creating text_parameter. Is this creating problem?
    Why do you have the leading Zero's if REF_NO is a NUMBER? Oracle will automatically strip the leading Zero's unless you specify REF_NO as a VARCHAR2. Your code sample used 000001 so this implied your REF_NO was a VARCHAR2. Is the Data Type of :PARAMETER.A_REF_NO a NUMBER or a CHAR? If it is a CHAR, you will need to cast the value to a NUMBER using the TO_NUMBER() function. You can't rely on Oracle to implicitly convert the CHAR to NUMBER - in fact - Oracle strongly recommends you always cast data type conversion rather than relay on implicit conversions.
    And wht do you mean by where clause in forms? are you talking about
    data block------properties-----------Query data source type------ From clause query------------ (WHERE ref_no=:PARAMETER.A_REF_NO)>
    Is your Datablock based on a From Clause Query? If yes, you can't using the BLOCK WHERE property to filter your block records. You will have to alter the From Clause Query each time. Let me know if you are using a From Clause and I'll show you how to make this work.

    Craig...
1 2 Previous Next

Legend

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