question

shanice.c avatar image
0 Likes"
shanice.c asked Jeanette F commented

Get value in code: Table.getRowByKey() and Table.getValueByKey()

Hello, I need some help in reading value in code.

1. I'd like to know the time item exit the Queue and Processor, there is one field that I need some help, which is exit time from Processor and Queue. I use Trigger onExit to record the time. But the value follows item. How could I track the item just leave from Queue or Processor, and read it's label value?

1627465556403.png


2. I would use the data in GlobalTable above, and then add fields in ItemLists. I use global table lookup to refer the data, but have problem with [value.row]. I tried to use Table.getRowByKey() and Table.getValueByKey(). but can not read values from table.

1627521360815.png



3. There's an exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Custom Code: Update EQ Table>variables/codeNode. What is the problem?

4. I use 3 Itemlists currently in my model, but I'd like to let AGV load item to Processor first if available, then load item to Queue secondly. Is there any way to push item from source to 2 different lists?

Thank you!

AGV write to table.fsm

FlexSim 21.1.4
flexsim 21.1.4getvaluebykeygetrowbykey
1627465556403.png (55.2 KiB)
1627521360815.png (141.9 KiB)
· 2
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Fiona C,

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.

Could you elaborate on what you mean in bullet 1 when you say "But the value follows item. How could I track the item just leave from Queue or Processor, and read it's label value?"

For bullet 2, do you use

Table("Name of Table").getRowByKey("key", "columnName")

For bullet 3, there is an error in your "custom code: Update EQ Table". I can't help you fix that without your model.

For bullet 4, you can sort the list by destination or partition if you would like the AGV to focus on certain flow items first.

I can more easily help you if you upload your model.



0 Likes 0 ·
shanice.c avatar image shanice.c Jeanette F ♦♦ commented ·

Hi @Jeanette F, Thanks for your reply. I'm sorry the model was not uploaded successfully yesterday, I have upload it again!

For bullet1, I used trigger to get the item exit time from Queue and Processor. Since the EQtable is specialized for saving data concerned Processor. I found the possible Processor status in my example are idle, processing, or blocked. Since item exit is not going to happen when Processor status is idle and processing. So in my custom code, I use If statement to writeto globaltable when status is blocked. But it's also unable to get exittime before item really exit the Processor.

Maybe it's a little bit meaningless to gain this data at this place. But I do this since hope can see whole Processor information dynamically.

For bullet2, I tried this but it seems some fields (EQLocation, pickupCP, EQID) still not getting the correct data.

For bullet3, please help me with fixing this error.

For bullet4, since the destination is unknown until find if there's Processor available. If there's no Processor available, destination is Queue. If there's Processor available, destination is Processor. How can I do this?

Thank you very much!

0 Likes 0 ·

1 Answer

Jeanette F avatar image
0 Likes"
Jeanette F answered Jeanette F commented

Hello @Fiona C,

Bullet 1: I suggest that you use the triggers on each of the objects to write to the global table instead of your custom code. I set this up on Processor1 for you.

Bullet 2: You were not using the .getRowByKey correctly. How I demonstrated above in code is how you should use it. I also used it in the list 3, so you can look there for a better example as well. Please note, the columns "pickupCP" and "EQID" still do not work because the EQLocation is written into the list like "/Processor1" and you write it into your table like "Processor1". I could not find where you write it into your table to fix this.

Bullet 3: This exception was from Process Flow in the activity called "custom code: Update EQ Table". To debug your custom code I used a break point and then went line by line through your code. The problem seemed to be coming from line 56 where you try to have "n/a" assigned to a number field. Please look at this and decide what you would like to have filled there instead. You could change the data in that field to be flexscipt.

Other Error: In your ProcessFlow_02 in the activity called custom code: Get Task, there is a character being used in line 10 that should not be there. Please review this code.

Several of your collums in your field could more easily be filled by triggers on the objects than by using your custom code. I suggest you consider changing that.

Bullet 4: This question requires better understanding of what you are trying to do with your process flow. I suggest creating a new post for this question. When you do so please give more deatails about what you are trying to accomplish overall and where in your process flow you might see your problem. I think there might be a simpler way to do this. You can tag me in the new question to help.

We are happy to help answer your questions. Please, consider making separate posts for different questions. Your questions are more likely to be answered quickly that way. Please, refer to our best practices.

agv-write-to-table_JF.fsm


· 6
5 |100000

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

shanice.c avatar image shanice.c commented ·

Hi, @Jeanette F, how could I write "/Processor1" to "Processor1"? This part is at Custom code: Update EQ Table, line 26th. Why it can only be refered if written in "/Processor1" format? What's this kind of purple font means?

1627823240163.png

I create a new post for the question pushing item to different lists. https://answers.flexsim.com/questions/105801/how-to-know-products-destination-then-push-product.html

Could you kindly help me with the problem? Thank you.


0 Likes 0 ·
1627823240163.png (59.9 KiB)
Jeanette F avatar image Jeanette F ♦♦ shanice.c commented ·

Hello @Fiona C,

The purple coloring means that it is a pointer. A pointer is an address to a specific object in the model. Here is how you can change that in your table within your custom code.

1628002661442.png

0 Likes 0 ·
1628002661442.png (14.4 KiB)
shanice.c avatar image shanice.c Jeanette F ♦♦ commented ·

Hi @Jeanette F ,I had fixed the script to write into a pointer, but the "pickupCP" and "EQID" value still not show up. Then, I use triggers to set a new label "QLocation" for item, and use it to get row, like the following picture, then the QueueID value did show up in list. But could I use table information without use another new label to get row? What's the script that should be put after "value._____", should it be a label or a column name of the table?


1628147739642.png


Does the it still have to be in purple font in the list when written to list or simply Processor name with a slash is correct?

agv write to table_0805.fsm

0 Likes 0 ·
Show more comments