daniel_mitrea_1995 wrote: »Correct, but my question was about the table fields. Maybe I mispronounced it.
How do I know which table field corresponds to the splited string. Do I have to take all the fields in the table, one at a time, and compare them to the string?
or is there another solution?
Answers
String := Eventstatus='Calculated' and ErrorCode='0000'
String := COPYSTR(String,1,STRPOS(String,'and') - 3);
String := COPYSTR(String,STRPOS(String,'=')+2,STRLEN(String));
How do I know which table field corresponds to the splited string. Do I have to take all the fields in the table, one at a time, and compare them to the string?
or is there another solution?
Ok I see, I missed the part where you said there can be different fields in the string
There are many way's you can do it but what I would do is to split the string on AND's and OR's then Parse each field name and value. Next step would be to filter on the fields that are in the string.
ex. how I would do it
WHILE (STRPOS(String,'AND') > 0) OR (String,STRPOS('OR') > 0) DO BEGIN
//Get next field name and field value and insert into temp table
//Delete the field from the string
END;
IF TmpTable.FINDFIRST THEN
REPEAT
CASE TmpTable."My Field Name" OF
'Eventstatus' : Rec.SETRANGE(EventStatus,TmpTable."My Field Value");
'ErrorCode' : Rec.SETRANGE(ErrorCode,'0000');
END;
UNTIL TmpTable.NEXT = 0;
IF Rec.FINDFIRT THEN
Do Stuff..