Skip to Content

Context Condition causes strange behaviour

My form displays item-level data from a table provided by the Interface.  The table has fields TYPE and AMOUNT (character and currency respectively).  If the TYPE is filled, then I want to display the AMOUNT; otherwise I don't want to display the AMOUNT.  To achieve that, I use Conditions on the AMOUNT field in the Context so that the AMOUNT is not shown if the TYPE is <space>.

If I have data like this, then everything is ok:

Item:    1     2     3     4

Type:    A     A     B     C

Amount: 1.00  0.00  2.00  3.00

But if the data is like this, then there is a problem:

Item:    1     2     3     4

Type:    A           B     C

Amount: 1.00  0.00  2.00  3.00

For item 2, the Condition is not met, so I don't want to display the AMOUNT.  But it goes wrong.

Instead of just suppressing the AMOUNT field, the form (for some reason) takes the AMOUNT from the next available item, and displays as if the data was like this:

Item:    1     2     3     4

Type:    A           B     C

Amount: 1.00  2.00  3.00

So for item 2, the AMOUNT is displayed without a TYPE, and no AMOUNT is displayed for item 4.

How can I prevent or avoid this strange behaviour?

Thanks,

Dave

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 04, 2013 at 10:34 AM

    Hi Dave,

    Can you provide the screenshot of the condition logic you have applied in the context?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Dave Willis

      Hi Dave,

      Thumb rule which generally followed is When the fields are in 'Design view' logic (FormCalc,javascript) is written in 'Form Ready' event.

      When the fields are in 'Master Pages' then logic is written in 'Layout Ready' event.

      Raghu

  • avatar image
    Former Member
    Aug 05, 2013 at 01:14 AM

    Hi Dave,

    I am not sure if the alternative can enter NULL.

    As normally in formcalc i will check 2 things one is "" and null.

    I have a suggestion which might be simpler solution for you.

    Go to form interface, in the initialization tab, do ABAP code to delete those record(s) with TYPE IS INITIAL. Put a break-point, so that you can debug your code(if your form is not from portal).

    And you no need to do any headache condition / alternative / formcalc scripting in form 😊

    Good luck.

    regards,

    Xiang Li

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 05, 2013 at 10:13 AM

    Dave,

      Please mention if you want to hide only the AMOUNT field or the total column??

    Regards,

    Naveen

    Add comment
    10|10000 characters needed characters exceeded