How to make a field invisible in a report

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

  • 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!


  • 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.
  • 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.
  • 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.
  • Ok, but what is the code for "Show empty variable", please?
  • if my condition then
    MyVariable := MyValue
    else
    MyVariable := '';
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Ok, thank you very much for help; i'll try it.
    Thanks.
  • 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?
  • 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.
  • Ok, thanks again for help.
    Thank you.