Cancel
Showing results for 
Search instead for 
Did you mean: 

importing data from txt file

Pioneer
Pioneer

Hello Everyone,

 

In model, i have different order and each order has one resource_plan (this info available in t_current_production_plan tablefile-check in attachment). All txt file of Resorce_plan are available in one folder of PC (in short-outside the plantsim)).Now i want to create all tablefile (if there is 50 order then create 50 tablefiles tn that particular folder) in one specifilc folder in plantsim and then assign name according to t_cuurent_production_plan. and now i want to fill this table from txt file of the same name.

((Ex. if table name is t_resource_plan_001_0_a then it will import data from t_resource_plan_001_0_a.txt

                                    t_resource_plan_002_0_b  then it will import data from t_resource_plan_002_0_b.txt ))

 

Note: Everytime number of orders are different corresponding number of resource plan also changeble.i will get this info from t_current_production_plan. i attached this table and method which i wrote. i already wrote one code in comment....

( --.Klassen.Input.Info.t_ResourcePlansFolder.node(i).readFile("Input_Data\t_Resource_Plan_001_0_a.txt");).

its working but from these code i can fill all table with same t_Resource_Plan_001_0_a.txt.. plz check it in attachment.

How can i fill all resourceplan table  from all ((but specific according to same name)) txt file

thanks in advance

 

2 REPLIES

Re: importing data from txt file

Phenom
Phenom

Here's a bit of code to individually set the  file name.

 

Please adapt the path and file name 

 

var path :string
var fileName :string
var extention :string

var file :string



path :="c:\\temp\\"  --- 
fileName :="test"   -- 
extention :=".txt

file :=path + filename + extention

....readFile(file)

 

Re: importing data from txt file

Pioneer
Pioneer

thanks @simulator..

its working good.