numtostring and param

numtostring and param

francesco_v2
Not applicable
270 Views
1 Reply
Message 1 of 2

numtostring and param

francesco_v2
Not applicable

[ FlexSim 19.0.1 ]

Hello someone could help me with the meaning of this command:I have the code below, do you know how work the command "param" and "+numtostring"? I mean when I use the command query what happen in a practical way?

i have the table Componentes that is structured in this way:

codProductocodComponenteBoxes
121
132
143
154
231
242
253
371
382
int codP1 = param(1);
int codP2 = param(2);
tActual = Table.query("SELECT * FROM Componentes \
		WHERE codProducto = " + numtostring(codP1, 0, 0) + " ORDER BY Box ASC");int filasAct=tActual.numRows;
tAnterior = Table.query("SELECT * FROM Componentes \
		WHERE codProducto = " + numtostring(codP2, 0, 0) + " ORDER BY Box ASC");		
int filasAnt=tAnterior.numRows;		




0 Likes
Accepted solutions (1)
271 Views
1 Reply
Reply (1)
Message 2 of 2

regan_blackett
Autodesk
Autodesk
Accepted solution

param() is a function to de-reference parameters that are passed into functions. You can see them used in the code header for any code editor window to see what parameters were passed into that event, like "item" and "current". The arguments passed into param are always a value to indicate which parameter was passed in ranked order. So param(1) means the first argument passed into this function.

numtostring() is a command that converts a numeric value into it's ASCII character (string dataype). This is important for your query because a query has to be text, so numbers have to be turned into strings for them to be used in a query like this. The '+' says to concatenate the text on the right of symbol with the text on the left.