question

Francesco V2 avatar image
0 Likes"
Francesco V2 asked Regan Blackett edited

numtostring and param

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:

codProducto codComponente Boxes
1 2 1
1 3 2
1 4 3
1 5 4
2 3 1
2 4 2
2 5 3
3 7 1
3 8 2
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;		




FlexSim 19.0.1
numtostring
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Regan Blackett avatar image
2 Likes"
Regan Blackett answered Regan Blackett edited

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.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.