Visible property of a column on a page

siimsandsiimsand Member Posts: 28
Hello!

I have these fields in a group (on a page) Field1, Field2, Field3, ... . They make up columns in a factbox. Field1 is an option type field with options 1, 2, 3, ... . I want to set the visibility of the Field1 to FALSE by default and the initial value in case a new entry is made for Field1 to option 1. I've done:

OnInsertRecord(BelowxRec : Boolean) : Boolean
Field1 := Field1::Option1; //this sets the Field1 value to Option1 after an entry is made (a new record entered)

Can't quite seem to figure out the code for changing the visibility to TRUE if and entry is made (a new record entered). Any help?

Thanks in advance.

Best Answer

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    For how long new record is a new record? If you insert it and milliseconds after NAV will read it is it still considered a new record?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • siimsandsiimsand Member Posts: 28
    edited 2017-12-21
    For how long new record is a new record? If you insert it and milliseconds after NAV will read it is it still considered a new record?

    I rather thought that if the whole row is filled with random data, aka when a new entry is made. Is the time really important here? Or the fact that a new row (entry, record) is made?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-12-21
    It is, at least in my opinion.

    You could, for example, add a global Var NewRec on the page, set it to TRUE in in OnInsert and reset it in OnAfterGetRecord. Then you could use this global var in the Visible property. But if the two happens almost immediately one after another (which is what really happens, refreshing visibility on the screen is tightly linked with refreshing records) then such a 'show when new' logic will not work. I mean it will but no one will be able to see the effects.

    Personally I'd rather try not to work on 'time basis' - is 'new' - is 'not new' condition, but I would try to come up with some different condition/rules when to show the field/column.

    Time-based conditions are much more tricky to code than you would initially think.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • siimsandsiimsand Member Posts: 28
    It is, at least in my opinion.

    You could, for example, add a global Var NewRec on the page, set it to TRUE in in OnInsert and reset it in OnAfterGetRecord. Then you could use this global var in the Visible property. But if the two happens almost immediately one after another (which is what really happens, refreshing visibility on the screen is tightly linked with refreshing records) then such a 'show when new' logic will not work. I mean it will but no one will be able to see the effects.

    Personally I'd rather try not to work on 'time basis' - is 'new' - is 'not new' condition, but I would try to come up with some different condition/rules when to show the field/column.

    Time-based conditions are much more tricky to code than you would initially think.

    Okay, so you're basically saying doing this is very complicated? The concept seems pretty simple. Set the visibility of the property to FALSE by default and simply to TRUE again with an initial value once a new row is entered with some data.
  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.