Announcement

Collapse
No announcement yet.

Use value variable SQL statement

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use value variable SQL statement

    Hello everyone

    I'm starting to use ScriptCase and want to do the following and can not:

    I have a statement I made with editing lookup select data type:


    SELECT Id_Peligro, NomPeligro, Flag
    FROM dbo.Peligro
    WHERE Id_TipoReporte = '{Id_TipoReporte}' AND Flag ='2'
    ORDER BY NomPeligro

    It runs with a fixed variable in this case 2, but the value of Flag should be a variable that comes from a radio control that has value 1 or 2, save the varible with name Btn_Flag replace the judgment SLQ and does not found

    SELECT Id_Peligro, NomPeligro, Flag
    FROM dbo.Peligro
    WHERE Id_TipoReporte = '{Id_TipoReporte}' AND Flag = '{Btn_Flag}'
    ORDER BY NomPeligro

    How I do?,Thanks in advance for the help

    Javier

  • #2
    Hi Javier,

    I don't think you need to assign an extra variable (Btn_Flag) to refer to the other field. Just use the field's name directly:

    SELECT Id_Peligro, NomPeligro, Flag
    FROM dbo.Peligro
    WHERE Id_TipoReporte = '{Id_TipoReporte}' AND Flag = '{Riesgo}'
    ORDER BY NomPeligro

    See if that works.

    Notice that the single quotes (') only have to be there if Flag is a text field. Values 1 and 2 are better represented by an integer datatype (e.g. tinyint) in the database, but that is another matter.

    Also, if you want the {Id_Peligro} of the form to respond immediately (having its value cleared) when {Riesgo} is changed use the Ajax section of {Riesgo} field to specify this.
    Last edited by Orion; 06-24-2016, 03:12 AM.
    Best regards,

    Frank

    Comment


    • #3
      Hi there man:

      when you edit your radio button, just under the section "lookup" where you set the value you have another section called "Ajax Processing" use that option to set the ajax event of the field, so when it is modified then you update the "Id Peligro" field to the newly generated value of your radio button.

      Regards

      Comment


      • #4
        Thank you very much for your help, it worked !!!

        Good day

        Javier

        Comment

        Working...
        X