Subscribe Bookmark RSS Feed

How to update all tables in a folder together in JSL?

frankzhao

Community Trekker

Joined:

Oct 13, 2014

Hi,guys,

I want to update all tables in a specific folder(my path) together matching by (COLUMN1 = COLUMN1 , COLUMN2 =COLUMN2),and add selected columns from update table,how can I write a script to realise this function in JSL?

Thanks for help

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Already solved,here is my script for whom may need.

mypath = ("my path"); 

Set Current Directory( mypath ); 

y = Files In Directory( mypath ); 

For( i = N Items( y ), i > 0, i--, 

  If( Ends With( y, "jmp" ), 

  , 

  Remove From( y, i ) 

  ) 

); 

n = N Items( y ); 

For( i = 1, i <= N Items( y ), i++,  

/* If the file is the first in the list, open it. Otherwise, open the table, concatenate with the main table, and close the table just opened. */ 

    If( i == 1, 

        mainDt = Open( mypath || y ),  

        dt = Open( mypath || y ) ;   

        mainDt = mainDt << update(with(dt),

        select (columns),

        by matching columns (column=column),

        Append to First Table ); 

        Close( dt, NoSave ); 

        Wait( 0 ); 

    ) 

  );     

mainDt<< Set Name( "update table" );

1 REPLY
Solution

Already solved,here is my script for whom may need.

mypath = ("my path"); 

Set Current Directory( mypath ); 

y = Files In Directory( mypath ); 

For( i = N Items( y ), i > 0, i--, 

  If( Ends With( y, "jmp" ), 

  , 

  Remove From( y, i ) 

  ) 

); 

n = N Items( y ); 

For( i = 1, i <= N Items( y ), i++,  

/* If the file is the first in the list, open it. Otherwise, open the table, concatenate with the main table, and close the table just opened. */ 

    If( i == 1, 

        mainDt = Open( mypath || y ),  

        dt = Open( mypath || y ) ;   

        mainDt = mainDt << update(with(dt),

        select (columns),

        by matching columns (column=column),

        Append to First Table ); 

        Close( dt, NoSave ); 

        Wait( 0 ); 

    ) 

  );     

mainDt<< Set Name( "update table" );