TESTFIELD with 2 condition in OR

andy76
Member Posts: 616
Hello,
I should make a TESTFIELD as in ex. following (that doesn't go right):
TESTFIELD(Type,((Type::"G/L Account") OR (Type::"Item")) )
I want the message if the type is not "G/L Account" and is not "Item".
Is that possible or do I have to use IF statement and message with text constant?
Thank you
I should make a TESTFIELD as in ex. following (that doesn't go right):
TESTFIELD(Type,((Type::"G/L Account") OR (Type::"Item")) )
I want the message if the type is not "G/L Account" and is not "Item".
Is that possible or do I have to use IF statement and message with text constant?
Thank you
0
Comments
-
if type <> type::glaccount then testfield(type,type::item); if type <> type::item then testfield(type,type::glaccount);
it's a bit ugly (if you have to add another condition you will be in trouble) but i think it works 4 your scenario(never tried)...
at least you don't have to create a new text constant0 -
andy76 wrote:Hello,
I should make a TESTFIELD as in ex. following (that doesn't go right):
TESTFIELD(Type,((Type::"G/L Account") OR (Type::"Item")) )
I want the message if the type is not "G/L Account" and is not "Item".
Is that possible or do I have to use IF statement and message with text constant?
Thank youif (type <> Type::"G/L Account") AND (type <> Type::"Item") THEN Fielderror(type);
in this case if Type is resource the error message will be:
"type must not be Resource in Sales Line blah blah""David Singleton0 -
To make it easier to understand using
if not type in [type::"g/l account",type::Item]
is much easier to read.0 -
Hello,
if not type in [type::"g/l account",type::Item] doesn't work ! :-k
better try
Here is the message displayed
Microsoft Dynamics NAV
This prefix operator cannot be used on Option.
OK
if (type <> Type::"G/L Account") AND (type <> Type::"Item") THEN
Fielderror(type);Do it your self0 -
Try this. Type is a field, like in table 37 or 39
if not (Type in [Type::"G/L Account",Type::"Item"]) then FIELDERROR(Type,'Must be "G/L Account" or "Item"');
But other question. What is with type BLANK like for the "ext. Text" of an Item or other Description lines with a BLANK type?Do you make it right, it works too!0 -
garak wrote:Try this. Type is a field, like in table 37 or 39
if not (Type in [Type::"G/L Account",Type::"Item"]) then FIELDERROR(Type,'Must be "G/L Account" or "Item"');
But other question. What is with type BLANK like for the "ext. Text" of an Item or other Description lines with a BLANK type?if not (Type in [Type::"0",Type::"Item"]) then FIELDERROR(Type,'Must be "G/L Account" or "Item"');
does not work?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
- 322 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