Cancel
Showing results for 
Search instead for 
Did you mean: 

find row in table

Creator
Creator

Hi all.

 

with the attached code i want to search a table file for an object and create and object with the data from the table.

my table looks like this

 

object | x | y

 

	Tabelle.setzeZeiger(1,1);	
	if Tabelle.finden({1,1},..{1,*},"Quelle") then	
		
	Zeile := Tabelle.setzeZeigerY;		
			
	positX := Tabelle[2,Zeile];
	
	Zeile1 := Tabelle.setzeZeigerY;	
	
	positY := Tabelle[3,Zeile1];
	
	obj := .Modelle.Netzwerk.Quelle.createObject(.Modelle.Netzwerk, positX, positY);

the code tries to search for "quelle" in the first column. if it finds "Quelle" it needs the information in the same row but column 2 and column 3. and with the information from column 2 and 3 it needs to create an object.

how can use the information from column 2 and 3? 

1 REPLY

Re: find row in table

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

if you find something in a table, Plant Simulation moves the cursor to this position, you need only to read the position (zeigerY), so you have some failures in your program:

 

Tabelle.setzeZeiger(1,1);	
if Tabelle.finden({1,1},..{1,*},"Quelle") then		
	Zeile := Tabelle.ZeigerY;				
	positX := Tabelle[2,Zeile];	
	positY := Tabelle[3,Zeile];	
	obj := .Modelle.Netzwerk.Quelle.createObject(.Modelle.Netzwerk, positX, positY);
end;
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net