Cancel
Showing results for 
Search instead for 
Did you mean: 

Find the minimum out of a subset of a table

Creator
Creator

Hi everyone!

 

I want to find the minimum value out of a table, but only for a specific subset of goods.

 

E.g. I have a Table with parts of the types A, B and C and a Timestamp when it was storaged. Now I want to retrieve an item of type A, which has been the longest in the storage.

 

How do I do that the most efficient way?

 

Greetings, Patrick

3 REPLIES

Re: Find the minimum out of a subset of a table

Siemens Phenom Siemens Phenom
Siemens Phenom
Utilizing the AttributeExplorer will help here. On its query-tab you define the MUs to be considered and on its attribute-tab you enter your timestamp. Accessing and sorting AttributeExplorer.ExplorerTable you can easily figure out which one is the oldest/youngest A/B/C.

Regards

Always consider using the AttributeExplorer!

Re: Find the minimum out of a subset of a table

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Patrick,

 

for your application with a store and under consideration of accessability you could use the following method with your table file

 

TableFile.sort(3,"down") --Sorts the column with availability (1/0) of your MUs, here it is column number 3 
TableFile.findFloor({3,*},0)--After sorting the first unaccessable row is found
TableFile.min({2,1}..{2,TableFile.CursorY-1})--Find the MU that is accessable and entered earlier than all the others (here in column 2)
print TableFile[TableFile.CursorX,TableFile.CursorY]--returns the entry time of that MU
print TableFile.CursorY-- returns row number of MU 
Kind regards,

Igor
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution


Re: Find the minimum out of a subset of a table

Creator
Creator

Thanks for both your answers!

The solution of Igor seems like a good workaround and works for my model.

 

Maybe I will look further into the attribute explorer, but at the moment I don't exactly know how to use it and can't find a proper tutorial, so while it might be a good solution in the long run my current knowledge limits it's applicability.