question

Liam Chiu avatar image
0 Likes"
Liam Chiu asked Andrew O commented

How can I Change color via GlobalTable

Hi,

I want to change the item color. I used triggers (set color by case) to change item color, but I wondering if I can use GlobalTable to set it when I have hundreds of item.


Thank you for your advance.

1659498017402.png1659498031287.png


FlexSim 20.1.3
global tabletriggerscolor change
1659498017402.png (412.9 KiB)
1659498031287.png (61.2 KiB)
· 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.

Andrew O avatar image Andrew O commented ·

Hi @Wei_cheng Chiu, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

Do you want to choose the specific color for each type? If not, you can use 'Color.byNumber()' to assign a different color to each item type.

1659507070998.pngTo assign specific colors I would suggest to set up a color palette.

1659507044569.png

When using a global table you would have to enter the RGB values for the each color (0-1 for each component) and read them in the trigger.

1659507348504.png


1659507044569.png (66.7 KiB)
1659507070998.png (11.3 KiB)
1659507348504.png (56.3 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.

Liam Chiu avatar image Liam Chiu commented ·

@Felix Möhlmann thanks for your response


I want to use the global table to specify the color of each label.

For example like Type101 I want it to be painted grey, Type200 I want it to be painted black, can I use a table to manage hundreds of product type with one Table?

The reason I want to do this is that if I want to make changes to the product, I can make changes directly to the table. It"s more flexible.


Thank again~ :)

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Liam Chiu commented ·

If you set the data type of the global table column to 'FlexScript', you can type in the color like you do in the trigger and then evaluate that cell to return the color value.

1659516061821.png

1659515943960.png

As I said above though, you can do essentially the same with a color palette (assign a color to each possible label value). The palette also allows you to customize the colors instead of just choosing from the 16 (?) pre-defined ones.

0 Likes 0 ·
1659515943960.png (44.9 KiB)
1659516061821.png (31.3 KiB)