Cancel
Showing results for 
Search instead for 
Did you mean: 

write a table via method

Creator
Creator

hi all,

 

i want to write a table via method, but i have one problem.

my table needs to contain information like (iconAngle, ZoomY, ZoomX, xPos, yPos) but not all of my objects have those information.

for example if i include a variable in my model (which does not posses an iconAngle) i always get an error from my method.

how can i work around this. how can i tell my method (via simtalk) that only those objects who have all of my information need to be listed in my table. or in other words. how can i skip those objects (in code)?

 

Thanks in advance

5 REPLIES

Re: write a table via method

Phenom
Phenom

Re: write a table via method

Creator
Creator

thanks so far. 

 

but how do i include that in my 

for...next... statement

 

now i get the error that BildWinkel (which is iconangle) is no string?

 

 

for i:=1 to root.anzahlObjekte loop
obj:=root.node(i);
positX := obj.XPos;
positY := obj.YPos;
Winkel := obj.BildWinkel;

executeSilent("getAttrNo(BildWinkel); return true; end; )
tabelle.schreibeZeile(1,tabelle.yDim+1, obj.name, obj.Klasse, positX, positY, Winkel, obj.ZoomX, obj.ZoomY);


next;

Re: write a table via method

Phenom
Phenom

in these cases I suggest to refer to the Plant simulation help (s.b.)

 

1. The getAttrNo parameter is a string (e.g. "Bildwinkel")

2. the path (e.g. obj) is missing

3. there is only 1 quote in your executeSilent methode callUnbenannt.png

 

 

 

Re: write a table via method

Gears Phenom Gears Phenom
Gears Phenom

And again, isNameUnique is so much simpler, why not use it?

var obj : object;

for var i:=1 to root.numNodes 
	obj:=root.node(i);
	if obj.isNameUnique("XPos") or obj.isNameUnique("YPos") or obj.isNameUnique("IconAngle") then
		-- at least 1 attribute missing!
	else
		TableFile.writeRow(1, tabelle.yDim+1, obj.name, obj.Klasse, obj.XPos, obj.YPos, obj.IconAngle);
	end;	
next;	

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Re: write a table via method

Creator
Creator

wow isname unique works like a charm 

thank you very much that is exactly what i was searching