Problem with SETVIEW

Hi all! I have a problem with the SETVIEW on a RecordRef: VarRecRef.OPEN(27,FALSE,COMPANYNAME); FilterText := 'WHERE(No.=FILTER(100100))'; // originally this string is built by a function VarRecRef.SETVIEW(FilterText); When running this an error occurs:

quote:


Ein ‘=’ fehlt in TransferFormulaData. WHERE(No.=FILTER(100100))


What’s wrong[?] Can anybody help[?] Thanx in advance! Regards, Jörg

I tried recref.open(27,false); filtertext := 'WHERE(No.=FILTER(100100))'; recref.setview(filtertext); message(recref.getview); on 3.60 and 3.70. worked perfectly. message returned: SORTING(No.) WHERE(No.=FILTER(100100)) I can invoke the error by replacing the filtertext-line with filtertext := 'WHERE(No.FILTER(100100))'; maybe your function that creates the filter expression is wrong?!?

Hi Beaver! Thanx for your answer! I just tried your code - copied from the posting - and the same error occured [B)] So mabe it’s a C/SIDE problem … I’m going to check my client … (But I’m glad that it seems not to be a code-problem [^]) Kind regards, Jörg

[:(!] Now I re-installed my client: MBS DE3.70 incl. all Hotfixes up to No. 10. The error still occurs …[xx(] What’s wrong?

[^] Now I got it!VarRecRef.OPEN(27,FALSE,COMPANYNAME); FilterText := 'WHERE(**Nr.=**FILTER(100100))'; // originally this string is built by a function VarRecRef.SETVIEW(FilterText); Before, the filter was build with the field-name, it has to be the field-caption (in Germany: No. Nr.) Beaver: How is your code running, german or english? Regards, Jörg

Hi, Joerg, Supposing the function that originally built the FilterText is GETVIEW, I advise you to use the function as GETVIEW(FALSE). If this is an option on your situation, these kind of problems can be avoided. I never thought the SETVIEW would require Captions… at first sight it looks as if the Field Names would be more logical. But then again if you want to show the result of GETVIEW to a User, it must be ML-enabled - which means Captions. This makes it imperative for SETVIEW to accept Captions back. In the end, I think this is why they have the UseNames parameter in the GETVIEW function. Sorry for drifting away… [:)]

Hi Nelson! Thanx for explaining the issue! My problem was, that I can not use GETVIEW … I have to run through a table and build the FilterText within a loop:Filter.SETRANGE("Table No.", TableNo); FilterText := 'WHERE('; REPEAT Filter.CALCFIELDS("Field Caption"); // formerly "Field Name" FilterText := FilterText + STRSUBSTNO('%1=FILTER(%2)', Filter."Field Caption", Filter.Filter); IF (Filter.NEXT <> 0) THEN BEGIN FilterText := FilterText + ','; Filter.NEXT(-1); END; UNTIL Filter.NEXT = 0; FilterText := FilterText + ')';

quote:


Originally posted by stryk I can not use GETVIEW … I have to run through a table and build the FilterText within a loop


Uff, That’s a little thougher! But the SETVIEW function will take either the FieldCaption (you just discovered this[:)]) or the FieldNumber. If it is possible to change your code just a little bit, you can built the FilterText with the FieldNumber instead.