Setfilter with more than 9 variables

Hi, I would like to invoke the setfilter-instruction with more than nine variables. i.e. Setfilter(Code, ‘%1|%2|%3|%4|%5|%6|%7|%8|%9|%10’, Variable1, Variabl2, Variable3, Variable4, Variable5, Variable6, Variable7, Variable8, Variable9, Variable10); But the instruction supports apparently only nine variables. Because the Variable10 is assigned to the dummy %1. Thank’s

Hi Try to create a text like this: MyTXT:= Format(MyFilter1) + '|' + Format(MyFilter2) ... and so on Setfilter(Code,'%1',MyTXT); bye André

But remember that Text type can be only 250 chars long! You should split filters on many Text variables…

quote:


Originally posted by Arthur
… You should split filters on many Text variables…


… or try to find another way (field) to filter. bye André

Hi André, thank you for your answer, but it doesn’t work. If I create a text with the filterfields, the Fieldfilter looks like this ‘4711|4712|4713|4714…’ But the Fieldfilter must look like this 4711|4712|4713|4714… (without the Apostrophe) below my code ltx_Filter := FORMAT(gco_Filter01) + '|' + FORMAT(gco_Filter02) + '|' + FORMAT(gco_Filter03) + '|' + FORMAT(gco_Filter04) + '|' + FORMAT(gco_Filter05) + '|' + FORMAT(gco_Filter06) + '|' + FORMAT(gco_Filter07) + '|' + FORMAT(gco_Filter08) + '|' + FORMAT(gco_Filter09) + '|' + FORMAT(gco_Filter10); SETFILTER(Code, '%1', ltx_Filter); bye Mike

quote:


Originally posted by Andre DDB
Hi Try to create a text like this: MyTXT:= Format(MyFilter1) + '|' + Format(MyFilter2) ... and so on Setfilter(Code,'%1',MyTXT); bye André


Hi

quote:


Originally posted by Deurges
Hi André, thank you for your answer, but it doesn’t work. If I create a text with the filterfields, the Fieldfilter looks like this ‘4711|4712|4713|4714…’ But the Fieldfilter must look like this 4711|4712|4713|4714… (without the Apostrophe) …


Please forget the %1 in this case. This should work: SETFILTER(Code,ltx_Filter); bye André

Hi, what about an array ? instead of gco_Filter01 upto 10 make an array with 10 dimensions. gco_Filter[1] for i := 1 to 10 do ltx_Filter += FORMAT(gco_Filter[i]) + ‘|’ Now its easy to add Filter No. 11 or 12. Karsten

But I’ll repeat that you ltx_Filter can be max 250 chars long, so be carefull with that.

Only in financials… on attain a text can have a maximum of 1024 chars.

Zimmer, If you want to create a recordset by a complex filter criteria and this is causing problems then why not declare a Temp record variable of the table. Apply the filters incrementally to the real record with as many lines of setfilter/setrange code as you like and add the resulting records to the temp table. When you are done… process the temp table as you need. Chris.

quote:


Originally posted by apertierra
Only in financials… on attain a text can have a maximum of 1024 chars.


I didn’t know that. That’s great [^]

You could do it the other way: create a temptable with the values you want to filter. Then filter the temptable fpr the value from the original table. So if you want to create a filter like tableX.SETFILTER(value1, ‘%1|%2|%3|%4’, value1, value2, value3, value4); you could do: filtertable.SETRANGE(filtervalue, tableX.value1); if filtertable.FIND(’-’) THEN value is found else value is NOT found in this way you can filter as much parameters as you want. But you have to set the filtervalues into the temptable before running the code. If you have steady values i would recommend to create a new table in your database with the filtervalues.

Using temp table decreases the performance and requires $ from customer. Usualy I use Table 375 “Dimension Code Amount Buffer” to temporary save unknown count of amounts.

Hey Arthur, i have not tested yet whether it slows the system if i use temptables. I’m using it to check our call-table. The call-table has around 7 million records in, which have to be checked (once a month). This check is provided by a temptable. I guess the temptable keeps around 1 million records at maximum. So i can’t imagine that the system becomes too slow. But - nevertheless you can be right. I’ve never looked for an other solution and haven’t optimezed the code. Perhaps it will be faster if i check it an other way… Using a system-table as temptable: isn’t it a risk to do so ? I had forgotten to set the property of a used table to “temporary”. So the complete table was deleted… but i had luck: i took a small used own created table with not much data in… :slight_smile: However, in my opinion the risk of deleting important data in a system table (lower than 50000) is too high to use it as a temporary table… (btw: we don’t have table 375, so i don’t know what data you store there and whether it’s important).

Table 375 is Buffer table. It means that in all codes it should be used as a temporary and I think no conflicts can appear. Also if you use a table as temporary, data isn’t saved in database so other objects (forms, tables etc.) can’t see/use it.