Forum Discussion

FP68's avatar
FP68
Helper I
7 months ago
Solved

Syntax problem

Hello,

I've a clolumn with a long string [TAGS] in which I can find "ApplicationName=xxxxxx"
In this string, each data is separate with ";"
I just want to know the position of the ";" after the "ApplicationName=..."

Countries2 = 

var _x= SEARCH("ApplicationName",[TAGS],0,-1)

var _z= SEARCH(";",[TAGS],value(_x),blank())

RETURN _z

My column Countries2 is a Text data type and I've the message "An argument of function "SEARCH" has the wrong data type or has an invalid value"
Thanks a lot for your help

  • Hi, 

    You may try

    Countries2 =
    VAR _x =
        SEARCH ( "ApplicationName=", [TAGS], 1, BLANK() )
    VAR _z =
        _x + LEN ( "ApplicationName=" )
    VAR _result=
        SEARCH ( ";", [TAGS], _z, BLANK() )
    RETURN
        _result
     
    Tested with some random data. 

     


     


     

3 Replies

  • Hi, 

    You may try

    Countries2 =
    VAR _x =
        SEARCH ( "ApplicationName=", [TAGS], 1, BLANK() )
    VAR _z =
        _x + LEN ( "ApplicationName=" )
    VAR _result=
        SEARCH ( ";", [TAGS], _z, BLANK() )
    RETURN
        _result
     
    Tested with some random data. 

     


     


     

  • Please try the measure below:

    Countries2 =
    VAR _x =
        SEARCH ( "ApplicationName=", [TAGS], 1, -1 )
    VAR _z =
        IF (
            _x > 0,
            SEARCH ( ";", [TAGS], _x, BLANK() ),
            BLANK()
        )
    RETURN
    _z