2 Replies Latest reply: Dec 19, 2014 2:43 PM by Ian Tsang RSS

    Execute part of script

    Eduard Cabanas Gili

      Hi,

       

      I have a very long script, and for testi the app, I would like to reload certain tables to check the changes and don't wait 20 minutes to wait to reload.

       

      I would like to create some buttons one for each  table. Is it possible to execute a script like i show clicking a button?

       

      SET QsgConAX = '[Provider=SQLOLEDB.1;Data Source=10.101.51.10;Integrated Security=SSPI;Initial Catalog=MicrosoftDynamicsAX] ()';

      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

      //////////////////////////////////////////FAMILIA_MAP:///////////////////////////////////////////////////////////////

      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

      OLEDB CONNECT TO $(QsgConAX);

      ITEM_EAN_MAP:

      Mapping

      Load ITEMID,ITEMBARCODE;

      SQL Select * From DBO.INVENTITEMBARCODE;

      UnQualify *;

       

       

      Many thank's

       

      Eduard

        • Re: Execute part of script

          There are numerous ways to do this, could any of the methods below be useful?

           

          1) If your LOAD statements are very much alike put them in a SUB function with parameters for the parts of the statements that differs (for example tablename), and call only the tables you wish to load. That is use comments or place IF statements around the ones you do not wish to load. Remember that your SUB needs to be placed above or before the function call in your script.

           

          2) A more direct way is to enclose your LOAD statements with "IF LoadTable1Variable THEN" statements and in the beginning of the script let the LoadTable variables take the values 1 or 0 to control which load statements to execute.


          If you need a button make the button control the IF statements via a variable.

          • Re: Execute part of script
            Ian Tsang

            Hi there. You might want to consider storing your data into QVD files. These load much faster than via odbc and you could even hive off a sample data set for testing e.g. 100k rows. Other than that split the script using if statements like Jonas suggests.