question

ana.pc2 avatar image
0 Likes"
ana.pc2 asked Jeff Nordgren commented

Query problems for Pulling

Hello! How are you all?

I am trying to code a query but I think I am having some troubles with the format of the string since the label Name is a mix of numbers and letters (Example: 67HYK). And if I leave it with only numbers, the query works, so I am guessing thereis where my problema is.

The label Name is a concat of two other labels, for example: ítem.label1 = 67, and ítem.label2 = HYK, and then ítem.Name = 67HYK (ítem.label1 + ítem.label2)… just in case this could be the problem.


I am pulling from a list with label Name, and this is my idea of the code but I get an Invalid pull query error, so I guess the error could be on this line:


string bname1 = Model.find("P1").Name;
string bname2 = Model.find("P2").Name;
string bname3 = Model.find("P3").Name;

string queryStr = "WHERE Name !=" + bname1 + " AND Name !=" + bname2 + " AND Name !=" + bname3 + " ORDER BY age DESC";

...

pulled = list.pull(queryStr, 1, addToBackOrders ? 1 : 0, current, partitionId, (removeFromList ? 0 : LIST_DO_NOT_REMOVE) | LIST_RETURN_BACK_ORDER_IF_NOT_FULFILL);


Any ideas to fix it??? Thanks! :)

FlexSim 20.2.3
flexsim 20.2.3pull from listpull requirement
· 7
5 |100000

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

ana.pc2 avatar image ana.pc2 commented ·

The label Name is pushed to the list like this:


Variant value = param(1);
Variant puller = param(2);
treenode entry = param(3);
double pushTime = param(4);

string final = value.label1+value.label2;

return /**/final/**direct*/;

0 Likes 0 ·
ana.pc2 avatar image ana.pc2 commented ·

And the label Name on Model.find("P1") comes from the same idea: Model.find("P1").label1 + Model.find("P1").label2

0 Likes 0 ·
Aida Chaikh avatar image Aida Chaikh commented ·

Hi @ana.pc2, can you attach the model or an example model? I'm not sure if the problem is in the queryStr or in the pull code.

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren commented ·

Hi @ana.pc2,

It's hard to know how to help without looking at your model. To receive a more accurate solution, please post your model or a sample model that demonstrates your question.

Proprietary models can be posted as a private question visible only to FlexSim U.S. support staff. You can also contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·
ana.pc2 avatar image ana.pc2 commented ·

So this query should be different for each processor… 46401 can only be in one (all same type goes to same location, not different:1_0a or 2_0a

0 Likes 0 ·
captura.png (7.3 KiB)
ana.pc2 avatar image ana.pc2 ana.pc2 commented ·

the query in this case will be :

string bname = current.label1 + current.label2;

string queryStr = /** \nQuery: *//***tag:query*//**/"WHERE B_P_Name == " + bname + " ORDER BY age DESC"/**/;

0 Likes 0 ·
Show more comments

1 Answer

ana.pc2 avatar image
1 Like"
ana.pc2 answered Jeff Nordgren commented

Oh, I think I got it. In case someone need it, this is how I fixed it:

Basically I changed all labels to numbers and use Variant instead of string...

I still wonder why it doesn't work with a string (mix of letters and numbers).

· 1
5 |100000

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

Jeff Nordgren avatar image Jeff Nordgren commented ·

@ana.pc2,

You don't want to use a string for a label that might be used as a lookup or in some other process/function. Stings are a LOT slower than number are so it's better to use a number anyway.


0 Likes 0 ·