question

Anggoro P avatar image
1 Like"
Anggoro P asked tannerp commented

Label Assignment: Pulling item from list with a specified condition

Hi, @Mischa Spelt @steven.hamoen

I want to use event-triggered source to pull items in list: distribution center that have ProductAge more or equal to 5

Any idea how to set the label assignment?

Choose One
event-triggered source
c.jpg (37.3 KiB)
5 |100000

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

Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Joerg Vogel commented

@Anggoro P I'm not sure but have you made the process flow tutorials? Please do that first.

To pull from a list you use the pull from list activity. I'm not sure what you want with a event triggered source listening to a list.

· 4
5 |100000

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

Anggoro P avatar image Anggoro P commented ·

@steven.hamoen

Yes, I have done that. I want to delete items that have age more than 5 days. Because the product has limited lifetime, after certain days, I want to collect how many products that should be scrapped or disposed due to expiration

If I use pull from list, seems like I need to create tokens first. I have tried using pull from list but nothing happened

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Anggoro P commented ·
@Anggoro P

yes all activities needs tokens to pass through. If you want to destroy a product when it is not collected within a certain amount of time, create a second token with the same properties (Create tokens activity) send that token through a delay with the max stay time and then try to pull it. Use the max wait timer to let it continue if it can't pull anything anymore because the product was actually collected in time.

0 Likes 0 ·
Anggoro P avatar image Anggoro P Anggoro P commented ·

@steven.hamoen

I also have thought about using stay time, but the problem is we have made different parameter, which is total age (age+source age) and realized that it is not a label (but a field in the list). So I don't know how to track this parameter on query

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

the pull from list activity pulls the value of the list, it is typically the item you pushed onto the list. If you want to get the data of the fields in a query, you store the result of the query into a table. There is the method directly by a Table.query (you finds this in my answer) or the List.PullResult variant maybe holding an array of the pull query of all matching items.

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Anggoro P commented

If you want to store more data of the list matching a query, you use a custom code and aTable.query on the list, before you pull anything. Then you "cloneTo" the result to a global table or table at a label node or you clone the result table into an array at a token label.

Table result = Table.query("FROM Listname WHERE age > 0.3");
Array data = result.clone();
return data; // return in an assign label activity 

Or a global table "ResultNew" or a table at a label node

Table result = Table.query("FROM Listname WHERE age > 0.3");
result.cloneTo(Table("ResultNew"));
· 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 ·

If you want to see the structure of the array of the token.label, you can print the token.label into the output console. The structure consists of an array of the rows of the table and each row consists of an array of the columns of the table.

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

@Jörg Vogel

Sorry I am new here so I didn't get the idea. Let me explain it more detail.

I have a production plant, a DC, and customers. A pull from DC activity has already used for matching customer demands and items available in DC (using required age condition)

On another hand, I want to make sure that items available in DC have age not more than, let say 5 days. Thus, I have made another pull from list activity, referring to scrapping items that have expired.

On the list I have made a new field called ProductAge, which is the sum of SourceAge (the aging due to production) and ShelfAge (aging in DC, dynamic)

Because every pull activity needs a token, I have created tokens using event triggered (not sure about this) the idea is to create token every time there is an item that has ProductAge >= 5 and the pull query is also the same. I doubt about this because I don't know how to use ProductAge on query

perishable-scm.fsm

0 Likes 0 ·
perishable-scm.fsm (23.5 KiB)
a.jpg (97.0 KiB)
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

If you want to pull more items, you build a loop and use the Max.Wait Timer. OnWaitTimerFired you release the token through another activity connection port.

pull-more-items-matching-list-attribut.fsm


5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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