An error happens when I run this code:
String := '';
Job.SETRANGE("Guest No.",Contact."No.");
IF Job.FIND('-') THEN BEGIN
REPEAT
String := String + Job."No." + '|';
UNTIL Job.NEXT = 0;
String := PADSTR(String,STRLEN(String)-1);
END;
Quantity := 0;
JobBudgetEntry.SETCURRENTKEY("Job No.",Date,"Phase Code","Task Code","Step Code","Resource Group No.");
JobBudgetEntry.SETFILTER("Job No.",String); // HERE THERE IS THE ERROR
My string sometimes can be longer than 20 character (Job No. is a Code[20]).
Why when I run the table and I press F7 (Field Filter) and I insert a text of more 20 characters like this:
PDA007|PDA008|PDA009|PDA010|PDA120 the error doesn't happen?
What can I do?
With Regards,
Giacchetto Yuri
0
Comments
the right way to filter is
JobBudgetEntry.setfilter(Job No.,'%1|%2|%3',str1,str2,str3);
but if you do not know the count of jobs you going to have then best if to put the jobbudgetentry filter inside the repeat loop.
Jobbudgetentry.setfilter(Job No, Job.Jobno);
cheers
I would not recommend this.
The max filter Length on a field as text is 720 CHAR.
U will soon reach the max length. I recommend to make a better function that builds a filter string like PDA007..PDA010|PDA125| PDA128.. PDA130
This also can reach the limit.. but will delay it.
MARK(TRUE)/MARKEDONLY(TRUE)?? Bad for the performance. U can`t set a key on it.
That's not completely true. The length of the filter is not the only limitation, the number of elements within the filter also play a role on how long the filter string can be.
These examples are just to illustrate my point
1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1
This may give an error because there are too many elements
12345|12345|12345|12345|12345|12345|12345|12345|12345|12345|
12345|12345|12345|12345|12345
A longer string but it has less elements
Have you tested this?
How many elements are possible?
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]