Returning multiple values from single function

vivek4121
Member Posts: 165
Hello,
Can anyone help me in that, how can I return multiple values from one function?
As NAV allowed to select only one return type in function declaration.
Thanks in advance.
Can anyone help me in that, how can I return multiple values from one function?
As NAV allowed to select only one return type in function declaration.
Thanks in advance.
0
Comments
-
You can pass parameters by reference (VAR) and change the value of the parameter in the function. But depending on what you want to do it is often times considered as a bad programing style to return more than one value. Have, for example, a look ad the DATE2DMY function from NAV, which you have to call three times to get all three return values.0
-
What according to you " and change the value of Parameter in the function"?0
-
Create a function and define two parameter, for example, Ret1 and Ret2 Check the "Var" mark before the variables.
At the begin of the function it is a good idea to reset the variables to their default values:CLEAR(Ret1); CLEAR(Ret2); // Some code Ret1 := 'Return value 1'; Ret2 := 'Return value 2';
You can now call this function from another place:MyFunction(x, y); // x is the first return value, y the second one MESSAGE('Value of x: %1 Value of y: %2', x, y);
0 -
Thanks.0
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