I need help parsing a string

I have this connection string.
String := Eventstatus='Calculated' and ErrorCode='0000'

This string will always have this format but can differ the number of the fields and the operator (it can be 'AND' or 'OR')

How I can parse this string in order to get those fields and values and then to filter a specific record accordingly ?
I should take all the table fields and compare with the spllitted strings ?

In the end I have to filter the record with those values. For example in this case:

Thank you

Best Answer


  • waitwait Member Posts: 39
    You can do this using COPYSTR and STRPOS, something like the following should work I would think

    String := Eventstatus='Calculated' and ErrorCode='0000'

    String := COPYSTR(String,1,STRPOS(String,'and') - 3);
    String := COPYSTR(String,STRPOS(String,'=')+2,STRLEN(String));
  • daniel_mitrea_1995daniel_mitrea_1995 Member Posts: 6
    edited 2020-05-26
    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?
  • daniel_mitrea_1995daniel_mitrea_1995 Member Posts: 6
    You did it.. again. Thank you :)
Sign In or Register to comment.