IF statement in the sourceexpr property
efassetta
Member Posts: 53
Hello,
i have a text control in a form, called TB
I need to set the sourceexpr property of it, in depending on the value of a field.
In other words IF a field is equal to 10 then value of TB is A, else B.
Is possible to do this?
Thank's.
i have a text control in a form, called TB
I need to set the sourceexpr property of it, in depending on the value of a field.
In other words IF a field is equal to 10 then value of TB is A, else B.
Is possible to do this?
Thank's.
1
Comments
-
What did you try?
As far as I know any expression put in the SourceExpr property should be a value. So what can you enter:
1. a variable (als being a field)
2. a boolean expression like B > A as this is either TRUE or FALSE (i.e. a value)
3. a value like 100, a, 1.0009
4. a function that returns a value
So this does not apply to an IF statement as an IF statement does not have a value.
But maybe my view is too narrow. 8)0 -
efassetta wrote:Hello,
i have a text control in a form, called TB
I need to set the sourceexpr property of it, in depending on the value of a field.
In other words IF a field is equal to 10 then value of TB is A, else B.
Is possible to do this?
Thank's.
Your describing your post in what I assume is a very broad/vague manner.
This field that equals 10 is it a field that a user enters data or is it a field that is calculated?
I don't think sourceexpr is what you're looking for here.
If you can describe a little better (more detail) we can help you solve your problem.
PS ca you add code or not - that's a helpful bit of info you might want to add.0 -
IF variable > 10 THEN
varaibletoshow := variable ELSE
variabletoshow := somethingelseMicrosoft Certified Technology Specialist
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist
http://www.navisiontech.com0 -
Thank's for your answer.
I try to explain better my problem.
I made a new form based on Customer Table.
I added on it a new text box called A.
The value of this text box (SourceExpr Property) depends on the value of the field Phone Number in the Customer Table:
- if the Phone Number is blank, A has to have the result of the function F1 (that is a function in a Codeunit)
- if the Phone Number is NOT blank A has to have the result of the function F2 (that is a function in a Codeunit)
Thank's a lot.lvanvugt wrote:What did you try?
As far as I know any expression put in the SourceExpr property should be a value. So what can you enter:
1. a variable (als being a field)
2. a boolean expression like B > A as this is either TRUE or FALSE (i.e. a value)
3. a value like 100, a, 1.0009
4. a function that returns a value
So this does not apply to an IF statement as an IF statement does not have a value.
But maybe my view is too narrow. 8)0 -
IF "Phone No." = '' THEN A := codeunit.functionone(parameters) ELSE A := codeunit.functiontwo(parameters)
most likely code needs to be inserted into OnAfterGetRecord triggerMicrosoft Certified Technology Specialist
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist
http://www.navisiontech.com0 -
Just put a function that returns a value into the source expression
CheckPhoneNumber that returns whatever you want (result of if statement or whatever)
The source expression will re-evaluate itself on each record
Steve0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

