9 Replies Latest reply on Jan 21, 2015 12:05 PM by siplus

    ExecuteSQL issue with serial numbers to create

    contactmip

      Hi everybody,

       

      I need to create a serial field depending on previous rows I may have created in a portal. The serial number option cannot be used in this case.

       

      The logic wood be :

       

      TABLE2 :

       

      NumberNameTownID_TABLE1
      1MaxParis56
      2HildegardeBerlin400

       

      I tried by using ExecuteSQL command on a calculated value trigger of my Number field by checking how many rows already exist related to the main table (TABLE1)

       

      ExecuteSQL( "SELECT COUNT(*) FROM TABLE2 WHERE ID_TABLE2 =" & GetField (GetFieldName ( ID_TABLE1 ));"";"" ) ) + 1

       

      It worked perfectly well BUT... only with the "Do not replace existing value of field" option deselected wich of course is not what I want as I need to keep my primary values.

      All I obtain is a ? instead of the incremented number. How come???

       

      Thanks for your help

       

      M