How to make a field invisible in a report

DarkHorseDarkHorse Member Posts: 389
Hello, I think this is easy. I know it can be done in properties, but how to make a specific field invisible in a report by code?.
Thanks.

Comments

  • krikikriki Member, Moderator Posts: 9,110
    You can't.
    There are 2 ways:
    1) define different sections for the different fields to show.
    2) In the OnAfterGetRecord-trigger, put the field in a global and show the global on the form. If the field must NOT be shown, you can blank the global.

    I would go for 2. It is easier to maintain.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    No direct way.... just way around...

    You can use more sections with making visible the correct section...
    You can use variable to show the value and if you do not want to show it, just clear the variable...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DarkHorseDarkHorse Member Posts: 389
    Thanks both for reply; but i need to do it on the same line, for example, if I has a report that shows in body section a relation of customers with an import like this:

    Customer.Field Import.Field
    Customer1 1.000
    Customer2 2.000
    Customer3 4.000

    I should put a condition that said IF Customer.Field:='Customer2" THEN Import.Field:= invisible. Then it shows like this:

    Customer.Field Import.Field
    Customer1 1.000
    Customer2
    Customer3 4.000

    ¿It's possible to do it?.
    Thanks.
  • kinekine Member Posts: 12,562
    Both ways I wrote about can be used...

    just think about it like

    IF Customer.Field:='Customer2" THEN
    Show empty variable
    else
    Show my value


    OR

    IF Customer.Field:='Customer2" THEN
    Show section without the field
    else
    Show section with the field
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DarkHorseDarkHorse Member Posts: 389
    Ok, but what is the code for "Show empty variable", please?
  • kinekine Member Posts: 12,562
    if my condition then
    MyVariable := MyValue
    else
    MyVariable := '';
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DarkHorseDarkHorse Member Posts: 389
    Ok, thank you very much for help; i'll try it.
    Thanks.
  • DarkHorseDarkHorse Member Posts: 389
    Sorry, one thing, my varibale is a decimal one, the MyVariable := '' doesn't works, it says me that the type is different, how I can do it?
  • kinekine Member Posts: 12,562
    DarkHorse wrote:
    Sorry, one thing, my varibale is a decimal one, the MyVariable := '' doesn't works, it says me that the type is different, how I can do it?

    That your variable is decimal is irrelevant. Your display variable will be text, but you assign into it empty string or decimal converted to text (FORMAT).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DarkHorseDarkHorse Member Posts: 389
    Ok, thanks again for help.
    Thank you.
Sign In or Register to comment.