Add a colume in the Tabular Form

garychickgarychick Member Posts: 34

I want to add a colume in the tabular form, but this new colume will display the value of a global variable instead of referring to a real field from the Table. Does anyone have idea?



  • Options
    KowaKowa Member Posts: 918
    Create a new column with a table field, then subsitute the global variable as the source expression.

    If necessary, calculate the variable values in the OnAfterGetRecord Trigger of the form.
    Kai Kowalewski
  • Options
    garychickgarychick Member Posts: 34
    Thanks Kowa,

    I know that I can 'create' a new colume in the tabular form by adding a new field in the Table, but I just want to know whether there is another method that achieve the same goal and without changing the table structure.
  • Options
    andreofandreof Member Posts: 133
    Add a textbox to the tablebox control. I think that was Kowa's idea.... :wink:
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
  • Options
    OtschkoOtschko Member Posts: 4

    you should create the columnn with an existing table field and then you have to change the 'SourceExpression' of this column to your variable.
    The calculation of this variable can be do in the 'OnAfterGetRecord'-Trigger.

  • Options
    saikiransaikiran Member Posts: 22
    Yes, you can add a textfield to a tabular form without changing the table structure. Better, you choose Add Label from the toolbox and then add the textfield to the tabular form.
    Its Table Relation property will be 'undefined'.
    Change its SourceExpr property to the Global variable you have declared earlier.
    You can even write code to manipulate the textfield behaviour at runtime. Write code within the form's OnNewRecord trigger.
  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    If you have a global variable with the same name as a field of the source table, just add "Rec." in front of the textbox source expression.
    E. g.: Instead of "Description" write "Rec.Description".
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Another possibility:
    Add a new column in the browser like Kowa and andreof have suggested.
    Create a function in the form (or in another object like this table or a codeunit) that accepts as a parameter a record of your table and has as return-value the type of your global variable. Put this function in the property "SourceExpr" of the new column. [eg. MyFunction(rec) ]
    Put the calculation of your return-value in that function and do an EXIT(MyReturnValue) in the function.
    In this way you don't need to put code in the "OnAfterGetRecord"-trigger and if needed, you can use this function in other places

    eg. of the function:
    PROCEDURE MyFunction(IrecCurrentRecord : Record NNN) : Decimal;
      // put here you calculation
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!

Sign In or Register to comment.