Announcement

Collapse
No announcement yet.

How to change dynamically the SQL from a filed type select .

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

  • How to change dynamically the SQL from a filed type select .

    Hi, i need to change the sql from a field type select.

    if the variable to evaluate is 'Yes' then the field has a SQL, if is 'No' the field has other SQL from other table.
    example:

    if var == yes
    {field_select} = "select a, b from table1";
    else

    {field_select} = "select c, d from table2";
    end if;

    Is possible do it with SC7?

  • #2
    Hi,
    did you think about using two separate 'custom' selects and switch between them with sc_field_display(). You can then grab the value of each field in an onChange event.

    if var == yes
    sc_field_display({select1},on);
    sc_field_display({select2},off);

    else
    sc_field_display({select1},off);
    sc_field_display({select2},on);

    end if

    onChange event select1
    {your_actual_field} = {select1};
    onChange event select2
    {your_actual_field} = {select2};

    Cheers
    jsb

    Comment


    • #3
      You can make a manual select and apply the sql to the value property behind yes or no label. But the question is then, can you use it in your query. If the fields to select (and which are used to map to screen variables) are different I think you are in trouble, at least if you have a standard form. But if you use this behind any event, ie. a button then this is very well possible.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Thanks you. i think that i have that to create a new form for that. The field do not the property for change the sql, and i dot want create two fields.
        Thank You and Best Regards

        Comment

        Working...
        X