Forum Stats

  • 3,767,981 Users
  • 2,252,736 Discussions
  • 7,874,399 Comments

Discussions

disable (not visible) data block

User_CU4QX
User_CU4QX Member Posts: 12 Green Ribbon

Hello,

I want to show a data block under one condition.

if xitem is null then show the data block else don't shox it.

how can i do this?

thanks,

PS:Forms [32 Bit] Version 6.0.8.11.3 (Production)

Best Answer

  • Frank Hoffmann
    Frank Hoffmann Member Posts: 796 Gold Badge
    Accepted Answer

    1.Make a procedure for it

    2.Place it in the exististing ON-POPULATE-DETAILS at the end of the code if you a a master/detail contruct plus WHEN-NEW-RECORD-INSTANCE to catch some special cases.

    3.Post the Code - do only do a switch of the Canvase (ON/OFF) if necessary.

    User_CU4QX

Answers

  • Frank Hoffmann
    Frank Hoffmann Member Posts: 796 Gold Badge

    Place your block on a stacked canvas, put it on the same window and do something like this:

    Default would be visible = false (not visible) for the stacked canvas

    -- Show View if :xitem and not visible

    if :xitem is null and GET_VIEW_PROPERTY('CN_DETAILS', visible) = 'FALSE'

    then

     SHOW_VIEW('CN_DETAILS');

     SET_VIEW_PROPERTY('CN_DETAILS', visible, property_true);

    else

    -- Hide only if necessary

    if GET_VIEW_PROPERTY('CN_DETAILS', visible) = 'TRUE'

     HIDE_VIEW('CN_DETAILS');

     SET_VIEW_PROPERTY('CN_DETAILS', visible, property_false);

    end if;

    end if;

  • User_CU4QX
    User_CU4QX Member Posts: 12 Green Ribbon

    thanks for your reply.

    But i have a problem.

    I don't need to create another canvas.

    I want to put my data block with other data blocks in the same canvas.

    What should i do in this case?

  • Frank Hoffmann
    Frank Hoffmann Member Posts: 796 Gold Badge
    edited Nov 2, 2021 12:25PM

    You have two options.

    1) Loop through the desired block and set all items invisible when the condition is met

    2) Make a stacked canvas of the size you need to hide the block during runtime,

    when the condition is met to cover the items


    If you want a fast and easy solution I would recommend the dynamic canvas solution.

    For every problem you need some code for a solution to solve it :)

    So you need additional code or and additional canvas. You decision

  • User_CU4QX
    User_CU4QX Member Posts: 12 Green Ribbon

    i am trying the second option.

    As i am new with forms, i still have one issue.

    where should i add my code?

    Is it in the data block trigger 'when new bloc instance'?

  • Frank Hoffmann
    Frank Hoffmann Member Posts: 796 Gold Badge
    Accepted Answer

    1.Make a procedure for it

    2.Place it in the exististing ON-POPULATE-DETAILS at the end of the code if you a a master/detail contruct plus WHEN-NEW-RECORD-INSTANCE to catch some special cases.

    3.Post the Code - do only do a switch of the Canvase (ON/OFF) if necessary.

    User_CU4QX
  • User_CU4QX
    User_CU4QX Member Posts: 12 Green Ribbon

    it worked thanks