Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamically Get the TableName in load Script

I am creating a dynamical way of creating my table.

Below example:

My table name is computed say

tableNaming = ‘table1’ ;

Now when I load I want

table1:

Load * from ……;

I am not able to use that Dynamical Table name… though if I display the value in a textbox it is correctly displayed.

sub CreateTableDynamically (Root)

Set tableNaming =mid(

                        '$(Root)',

index('$(Root)','\',-1)+1 ,

index('$(Root)','_',-1) - ( index('$(Root)','\',-1)+1)

                     )  & ‘:’;

$(tableNaming);

LOAD * 

FROM [$(Root)] (txt, codepage is 1252, embedded labels, delimiter is '|', msq, header is 1 lines);

       

end sub

4 Replies
Not applicable
Author

OK i have computed the value of  tableNaming, but now i get

Started loading data

The following error occurred:

Unknown statement

The error occurred here:

additionaldocuments1:

Data has not been loaded. Please correct the error and try loading again.

Where additionaldocuments1 is my COrrect value, but the load is not working

sub CreateTableDynamically (Root,tableNaming)

     $(tableNaming);

     LOAD * 

     FROM [$(Root)] (txt, codepage is 1252, embedded labels, delimiter is '|', msq, header is 1 lines);

       

end sub

Not applicable
Author

OK i managed to get it work

sub CreateTableDynamically (Root,tableNaming)

Set QueryMy = $(tableNaming) 

                 LOAD *    

                 FROM [$(Root)] (txt, codepage is 1252, embedded labels, delimiter is '|', msq, header is 1 lines);

           $(QueryMy);

//      $(tableNaming);

//      LOAD * 

//      FROM [$(Root)] (txt, codepage is 1252, embedded labels, delimiter is '|', msq, header is 1 lines);

       

end sub

Not applicable
Author

speedUp.png

ali_hijazi
Partner - Master II
Partner - Master II

from the first glance I would say you need to put : instead of ; after $(tableNaming)

I can walk on water when it freezes