question

Linda N avatar image
0 Likes"
Linda N asked Joerg Vogel commented

Count entries on list by label value(s)

Hi all,

At the end of a work day, I want to count how many orders missed the deadline (CutOffTime). The orders are on a list named "List: Finished Orders" and I have a global variable currentDay which tracks the current day number.

I track two labels on the list CutOffDay and lateOrder. I wish to determine the number of orders on the list where CutOffDay = currentDay and lateOrder = 1. I figured I should do this with a query but I only have limited experience querying a list in the process flow objects, but for this one I want to determine it in an integer variable and write it to a table so I can assess the statistics later on. I haven't managed to figure it out myself yet, could someone help?

lateorderstellen.png

Thanks in advance!

Linda

FlexSim 19.0.0
labelslistquerylabellable
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

Try it with a table query over the global list. You use a COUNT clause of the values WHERE your conditions are fulfilled.

0 Likes 0 ·

1 Answer

Linda N avatar image
0 Likes"
Linda N answered Joerg Vogel commented

My list is not global, is that a problem?
I'll have to look into this, i've never written a query in flexscript before (at least not the Table.query() variant). Would be great if you could help me out with an example on this case!

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

Joerg Vogel avatar image Joerg Vogel commented ·

It is a problem if the list isn’t a global list, then you can’t use table.query over the list. Please refer to the manual SQL Queries Table Selection.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel commented ·

You find a SUM clause example sum label in global list.

0 Likes 0 ·