question

Yin Mo avatar image
1 Like"
Yin Mo asked Matthew Gillespie commented

Find a matching value in a global table

I created a global table to store processing time by part name and part types. When the part 'token' arrives with part name and part type label assigned, how to extract the 'matching' processing time from global table?

I need to find the UPH by matching the first four columns: BodysizeX, BodysizeY, BIN_SORT_REQ and IS_CB_TEST, so not two dimensional table. Is there a way?

Choose One
FlexSim 17.1.2
global tablequery
5 |100000

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

Jacob Gillespie avatar image
1 Like"
Jacob Gillespie answered Jacob Gillespie edited

Using Table.query() you could get UPH like so:

int x = 10;
int y = 10;
string binSortReq = "Y";
string isCbTest = "N";

Table result = Table.query(
"SELECT UPH FROM BinSortTime \
 WHERE BodysizeX  = $1 \
 AND BodysizeY    = $2 \
 AND BIN_SORT_REQ = $3 \
 AND IS_CB_TEST   = $4",
x, y, binSortReq, isCbTest);

int uph = result[1]["UPH"];
5 |100000

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

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

You should restructure your table such that one dimension is the part name and the other is the part type, like this:

A B
A 10 15
B 5 7

Then you can just look up the cell you want using the part name and type as the index:

int processingTime = Table("TableA")[token.PartName][token.PartType];
· 3
5 |100000

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

Yin Mo avatar image Yin Mo commented ·

Thanks, Matthew. The table I used in my illustration is just an example. My real data looks like below table:

I need to find the UPH by matching the first four columns: BodysizeX, BodysizeY, BIN_SORT_REQ and IS_CB_TEST, so not two dimensional table. Is there a way?

Thanks

Yin

0 Likes 0 ·
c2mby.png (7.3 KiB)
Jason Merschat avatar image Jason Merschat commented ·

How does this method work? I am trying to use token labels to look up a value in a table using the row header. The correct label is being found for the row, but it is not using it the way described

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Jason Merschat commented ·

What version of the software are you using? It looks like you're using an older version of that pickoption that stores the row in a number and not a variant.

I would just type the code directly into the field and not even bother with the pickoption:

Table("GT_Routings")[token.lblMaterial][5]
0 Likes 0 ·
Kari Payton avatar image
0 Likes"
Kari Payton answered Yin Mo commented

See this post

· 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.

Yin Mo avatar image Yin Mo commented ·

Hi Kari,

Thanks for the reply. I am not sure whether I can use list in the example you posted. My case is that I have x units of part A, B, C ...arrives with part_name and part_type label assigned to each and I want to calculate processing time for each part. The processing time/unit is stored in a tableA like

PART_NAME PART_TYPE PROCESSING_TIME
A A 10
B A 15

If using SQL query, I would be able to find the processing time/unit by 'SELECT processing_time from tableA where label.part_name = tableA. part_name and label.part_type = tableA.part_type

Is there a way to write this query in FlexSim?

Thanks

0 Likes 0 ·