question

Jarek O avatar image
1 Like"
Jarek O asked Jarek O commented

Query expression for acquiring/pulling values based on token.arraylabel

I have a token with a label (type array) containing some values. I want to acquire the values in this array from a resource by an "Acquire Resource" activity. I type in the Query "WHERE value IN token.arraylabel" but it throws an exception. What is the correct expression?

Thank you,

Jarek

Choose One
sql
5 |100000

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

anthony.johnson avatar image
2 Likes"
anthony.johnson answered Jarek O commented

In list queries there is no locally accessible "token" keyword. There is only "value" and "puller". The problem is that, with a list of tokens, tokens are often both the values and the pullers, so in this context a "token" could be ambiguous. I think what you need is:

WHERE value IN puller.arraylabel

You need to make sure that the puller you pass in (it's a setting on the Pull From List activity) is the object (or token) that has the label with the array on it.

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

Jarek O avatar image Jarek O commented ·

Hi @anthony.johnson,

Thank you. I made a work around because my array consists of objects and not strings. Puller.arraylabel seemed not to work in that case (hard to tell because SQL doesn't give explanations to errors).

So I made a subflow and I defined a label array_index with value: array_index.length.

Then I grabbed the object.name in the array and decremented the array_index with -= 1.

With that string I then got my resource entering WHERE value=object.name in the query field.

A simple condition statement was added to check if the array_index is not zero completed the "for loop".

This is not a clean solution but it will do for the mean time.

0 Likes 0 ·
Sam Stubbs avatar image
-1 Like"
Sam Stubbs answered Jarek O commented

I'm not quite sure what you mean by "acquire the values in this array from a resource." The query field in the acquire resource is for querying for objects withing that resource group. You can query by any of the fields you have set up for that resource group. (These could be labels on the object, which you then add as a field to your resource. To do this click on the Advanced tab in your Resource properties, and you'll see a window where you can add and define fields that can be queried in your Resource group.)

To get values from a label array, you'll need to find another way to parse through them, such as a 'for loop.' Or perhaps you could add a label array to a table and then query the table.

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

Jarek O avatar image Jarek O commented ·

Thank you for your answer. I will explain you the situation more clearly.

I have a resource activity that contains a group of 3D objects. I have a token entering an Acquire Resource activity which has a label with type array containing 3D objects. I now want to pull the objects from the resource that match with the ones in the array. Can I do this with SQL? Or should implement a forloop somehow.

0 Likes 0 ·

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.