Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Check two ARRAYS for values [structure formula]

Toni Strauchfuss
Contributor
September 2, 2024

Hello everyone,

I have an ARRAY with alphabetical values in a structure formula.
And I have a second ARRAY, also with alphabetical values. Both ARRAYs are sorted.


I want to output the values from the first ARRAY that are not contained in the second ARRAY.

Something like that:

WITH A = ARRAY("One","Two","Three") : 
WITH B = ARRAY("One","Three") :

WITHOUT(A, B)

result -> One, Two, Three
I expect -> Two

 

The WITHOUT function unfortunately only allows one value.
Is there any solution for my problem?

 

BR,

Toni

2 answers

1 accepted

0 votes
Answer accepted
Stepan Kholodov _Tempo_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2024

Hello @Toni Strauchfuss 

You can use a formula like this for comparing two arrays and returning the difference between them:

with Array1 = ARRAY(...):
with Array2 = ARRAY(...):
Array1.FILTER(x -> !Array2.CONTAINS(x)).JOIN(", ")

I hope this helps. If you need further assistance with the formula or if you have other questions about Structure, please reach out to us directly at our support portal.

Best regards,
Stepan
Tempo (the Structure app vendor)

Toni Strauchfuss
Contributor
September 3, 2024

You are my SUPER-HERO today! 👍🏿

Thank you very much.

Like Stepan Kholodov _Tempo_ likes this
0 votes
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2024

I am not sure, but would this work?

FILTER(A, item -> NOT(IN_ARRAY(B, item)))

 

Toni Strauchfuss
Contributor
September 3, 2024

IN_ARRAY is unknown on my Jira instance but that script also works: 

WITH A = ARRAY("One","Two","Three") : 
WITH B = ARRAY("One","Three") :

A.Filter(x -> NOT(CONTAINS(MERGE_ARRAYS(B),x)))
Thanks Tuncay.
Like Tuncay Senturk likes this
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2024

Aaah yes, it is CONTAINS not IN_ARRAY

thanks for correcting 

Suggest an answer

Log in or Sign up to answer