Cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Method Code

Creator
Creator

I am currently using the following code (found in http://community.plm.automation.siemens.com/t5/Plant-Simulation-Forum/The-last-row-of-a-column-in-a-...

to assign the values allocated in the last row of the list to variables.

is
do
	ImportedValues.readFile("InitValuesForModel.txt");
	
	ImportedValues.setCursor(1,1);		
	
	ImportedValues.find({1,1}..{1,*},void);
	local rowNumber :=ImportedValues.cursorY;
	
	--Assign values which was read in to the variables
	ReorderPoint := str_to_num(ImportedValues[1,rowNumber]);
	ReorderQuantity := str_to_num(ImportedValues[2,rowNumber]);
		
end;

 the values in the list are as follows:

 

List.png

 

but the values that are assigned to the variables remains as follows:

Values.png

Please help with the code to assign the values in the last row to the variables!

 

Thank you for help (in advanceSmiley Happy

2 REPLIES

Re: Problem with Method Code

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

if the data are form a "rectangle" (no gaps, the same number of entries in the columns), you can use yDim to get the last entry:

 

ReorderPoint := str_to_num(ImportedValues[1,ImportedValues.yDim]);
ReorderQuantity := str_to_num(ImportedValues[2,ImportedValues.yDim]);
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Problem with Method Code

Creator
Creator
Thanx alot Steffen! Appreciate!