Use TableFilter field in SETVIEW

RnR
Member Posts: 21
Hi,
I've created a new table with rules to apply on the Customer table.
The new table includes a field of data type TableFilter which I have named Customer Filter. As a property I have set the field to link to TableIDExpr 18 (the customer table).
If I run the table and set a Customer Filter value of: Customer: No.=01000000...02000000
Then run a code in a codeunit:
myCustomerNo := 01000100;
r_Customer.GET(myCustomerNo);
r_Customer.SETVIEW(FORMAT(r_MyNewTable."Customer Filter"));
//IF a customer exists, I will alter some values for that customer..
An error occurs which sais: You cannot enter 'Customer: No.=01000000...02000000' in TableView.
Is it possible to use the tablefilter field to apply a filter to a record??
I've created a new table with rules to apply on the Customer table.
The new table includes a field of data type TableFilter which I have named Customer Filter. As a property I have set the field to link to TableIDExpr 18 (the customer table).
If I run the table and set a Customer Filter value of: Customer: No.=01000000...02000000
Then run a code in a codeunit:
myCustomerNo := 01000100;
r_Customer.GET(myCustomerNo);
r_Customer.SETVIEW(FORMAT(r_MyNewTable."Customer Filter"));
//IF a customer exists, I will alter some values for that customer..
An error occurs which sais: You cannot enter 'Customer: No.=01000000...02000000' in TableView.
Is it possible to use the tablefilter field to apply a filter to a record??
0
Comments
-
[Topic moved from NAV Tips & Tricks to NAV/Navision forum]0
-
RecRef.SETVIEW(TableFilter2View(FORMAT("Table Filter")));
TableFilter2View(TableFilter : Text[1024]) View : Text[1024]
// TableFilter format:
// <TableName>:<FieldCaption>=<FieldFilter>,<FieldCaption>=<FieldFilter>,..
// View format:
// [SORTING(<Key>)] WHERE(<FieldCaption>=FILTER(<FieldFilter>),<FieldCaption>=FILTER(<FieldFilter>),...)
IF TableFilter = '' THEN
EXIT('');
View := 'WHERE(';
FOR CharNo := STRPOS(TableFilter,':') + 1 TO STRLEN(TableFilter) DO BEGIN
CASE TableFilter[CharNo] OF
'=': View := View + '=FILTER(';
',': View := View + '),';
'"':
BEGIN
CharNo := CharNo + 1;
REPEAT
View := View + FORMAT(TableFilter[CharNo]);
CharNo := CharNo + 1;
UNTIL TableFilter[CharNo] = '"';
CharNo := CharNo + 1;
END;
ELSE
View := View + FORMAT(TableFilter[CharNo]);
END;
END;
View := View + '))';
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