Notice of Maintenance on October 9th. Click here for further details.

Convert string to column name

Hi, how to convert string to column name? I want to filter a table and get the value of a column but the name of the column is obtained by the variable i

  • 0

    Hi,

    I'm not really sure about your request. But I think assign or evalue. 

    Assign (sageerpx3.com)

    Evalue (sageerpx3.com)

    If not, other option is use SQL inside 4GL:

    Local Clbfile WSQL_CMD
    If [F:TSQ]XARGCSALDO<>2
       Case [F:TSQ]XARGTSALDO
          When 1 : WSQL_CMD="select sum(AMTNOTL_0) from XARGACOH where ACOSQH_0='"+PACOSQH+"'"
          When 2 : WSQL_CMD="select sum(AMTATIL_0) from XARGACOH where ACOSQH_0='"+PACOSQH+"'"
       Endcase
    Else
      Case [F:TSQ]XARGTSALDO
       When 1 : WSQL_CMD="select sum(AMTNOT_0) from XARGACOH where ACOSQH_0='"+PACOSQH+"'"
       When 2 : WSQL_CMD="select sum(AMTATI_0) from XARGACOH where ACOSQH_0='"+PACOSQH+"'"
      Endcase
    Endif

    If PTYP=1 and PSOH<>''
        WSQL_CMD+=" and ACOSOH_0<>'" +PSOH+"'"
    Endif

    For (Decimal SALDO) From num$((GTYPDBA*2)+1) Sql WSQL_CMD As [SQL_SAL]
        WSALDO=[SQL_SAL]SALDO
    Next

    Regards,

  • 0

    Thank you 

    I am very glad that you answered my question