Announcement

Collapse
No announcement yet.

Using Variable to Change the Table Name of an Application

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

  • Using Variable to Change the Table Name of an Application

    Hi,
    im using a variable to change the table name of an application in its sql connection settings. and it's working.

    However, I also have other sql select commands in different events of the application and some part of the table name of these other select commands are the same with the table name of the application. To illustrate:
    "Variable name used for replacing the table name.
    Please indicate the name of the table that will be replaced by the variable value."
    Form app table name:
    sample

    Variable:
    var_table_name

    Name of the table that will be replaced:
    sample

    to put value in the variable:
    [var_table_name] = 'new_table';

    Other SQL commands:
    sc_exec_sql("SELECT id FROM sample_only WHERE id > 1");
    sc_exec_sql("SELECT name FROM sample_again");

    Effect to the Other SQL commands:
    sc_exec_sql("SELECT id FROM new_table_only WHERE id > 1");
    sc_exec_sql("SELECT name FROM new_table_again");

    Here, you can see the Effect to the Other SQL command where the table name of the sql command is also affected by the change of table name when it's not supposed to be. Only the table name of the application should be changed and it should not affect the other sql commands used in different events in the app.
    Screen Shot 2019-08-23 at 23.43.52.png

  • #2
    One possible solution is:
    set variables for your table names:
    $table1 = "sample_only";
    $table1 = "sampe_again";

    your comands:
    sc_exec_sql("SELECT id FROM $table1 WHERE id > 1");
    sc_exec_sql("SELECT name FROM $table2");

    Comment


    • #3
      Originally posted by alvagar View Post
      One possible solution is:
      set variables for your table names:
      $table1 = "sample_only";
      $table1 = "sampe_again";

      your comands:
      sc_exec_sql("SELECT id FROM $table1 WHERE id > 1");
      sc_exec_sql("SELECT name FROM $table2");
      Hi,
      I will definitely try this.
      Unfortunately, I discovered that the Refined Search is also affected.
      Screen Shot 2019-08-31 at 01.35.08.png

      Comment

      Working...
      X