Newbie question - associate a function to a Table box coumn

ferris
Member Posts: 23
I want to associate a function to a Table box coumn. I have create a function test() with a return value Code and I have set the function as SourceExp of the column.
How can I recover the data of the table box in the function?
And how can I display the data of an array in the function into the table box.
In other words: haw can I recover or set a value of a table cell using a function? With the xy coordinates?
How can I recover the data of the table box in the function?
And how can I display the data of an array in the function into the table box.
In other words: haw can I recover or set a value of a table cell using a function? With the xy coordinates?
0
Comments
-
As parameters to the function, you best give the current record and a second parameter you give an integer (or option or text or whatever) so in the function you can identify the column who is calling it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
My problem is the first parameter: if I set the return value of the function to 'xxx' all rows of the table box are set to 'xxx'.
How can I recover the value of the the selected row and the index of the row?0 -
Use a variable instead of a function, and on the onaftergetrecord event put var := funtion. This should do it (without testing).Andre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
if you want to get the value back, add a field to the table and fill the field with the function value again on the onaftergetrecord eventAndre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
I'm sorry I don't undestand :oops: ](*,):
If I put a text in a column and a variable as sourceExp, each row of the table box share the same variabile.
How can I set a different sourceExp for each row? Obviously the number of rows is dinamic.0 -
Example:
OnAfterGetRecord()
BEGIN
var := Funtion();
END;
This has several problems:
you cannot get the value of a specific line, if you scrolldown and up the records you will get different values.
The best way is to create a field in the table and just use that field to store the value you want.
OnAfterGetRecord()
BEGIN
field := Funtion();
END;Andre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
Better is :
make a function Test that accepts 2 parameters:Function Test(IrecMyTable : record "My Table" ; IintTheColumn : INTEGER) : Text 250 // "IrecMyTable" contains the record for which the function has been triggered // "IintTheColumn" contains an integer for the field for which the function is triggered (you can use FIELDNO("The Field") in case it is a field of the table or you can use your own numbering)
So in the "SourceExpression" can putTest(rec,FIELDNO("Some Field"))
This is a more beautifull way of triggering the function instead of using "OnAfterGetRecord".Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
yeah, beautifulAndre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
andreof wrote:Use a variable instead of a function, and on the onaftergetrecord event put var := funtion. This should do it (without testing).
There is no on after get record for a table box if you do not link it to the main form, i.e. if you want to put a table box on a form with variable columns not belonging to the table of the main form you will not have a onaftergetrecord trigger.Saro0 -
have you tried to use a tablebox without it being connected to a form?Andre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
to a form record i meanAndre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
yes that's what i'm talking about if you use a table box without connecting it to the form, the onaftergetrecord will only be executed once, and the first line of the table box will be filled, except for the whole thing is disabled so you cannot access the data in the table boxSaro0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions