Select to view content in your preferred language

[Arcade] How to retrieve all values which has a common ID in another collumn ?

2032
17
Jump to solution
07-15-2024 06:56 AM
JasonBOCQUET
Frequent Contributor

Hi,

I'm working sometimes on Arcade and i'm blocked by a point :

 

I have a table with some teams of people. Each people have a manager (the ID is MANAG001, MANAG002...).

Each people is represented by a point on a map. 

 

I want by clicking on one of the people be able to see on the pop-up box all of the other people who have the same manager that the guy who I clicking on. 

If I click on me, i'm able to see my manager is MANAG004 and i can see the other people who are managed by MANAG004 on a list or a table in the popup.

 

How can I do that with Arcade expression ? 

I've read that Arcade does not support direct interaction with the clicked point’s ID; so maybe i can"t do that ?

 

thx 🙂

0 Kudos
17 Replies
jcarlson
MVP Esteemed Contributor

Put "Concatenate(match_arr, '\n')" in the text object at the end. You're putting the entire array into your HTML object, you don't really need to do that.

return {
type: 'text',
text: Concatenate(match_arr, '\n')
}

You could also try replacing \n with <br>.

- Josh Carlson
Kendall County GIS
0 Kudos
JasonBOCQUET
Frequent Contributor

Great, your solution work too.

Thanks for your help. Any idea of why I can"t see other people ? Actually he show me only the people which i click on, it's not very interesting.

 

I miss something to make the other rows with the same ID in my popup ? 

0 Kudos
jcarlson
MVP Esteemed Contributor

I'm not sure I understand. The way it's written, any row with the same ID will be included in the filtered set. Are you testing this against an ID that you know has more than one feature with that value?

- Josh Carlson
Kendall County GIS
0 Kudos
JasonBOCQUET
Frequent Contributor

90% of the dataset have min. 1 other people who have the same ID.

 

When i click on point which have another point on the map with the same ID, i always have the name of the current point i've clicked who appears on the pop-up box.

 

I do not have the other point who have the same ID.

0 Kudos
JasonBOCQUET
Frequent Contributor

@jcarlson Ok i find why it make a problem. My map is filtered to appears only one type of people (they are classified in 2 under-class).

That's why i do not see other one on the pop-up box,  it's because they don't appears on the map.

 

it's not possible to get they're information (from the second under-class that i don't show on my map) on the pop-up box without show them on the map ? 

0 Kudos
jcarlson
MVP Esteemed Contributor

Change your expression to use FeatureSetByPortalItem instead, that will go around the filter.

var fs = FeatureSetByPortalItem(
Portal('your portal url'),
'itemID of the layer',
0, // or whatever the layer index is
['ets_siren', 'ets_date_creation'],
false
)
- Josh Carlson
Kendall County GIS
0 Kudos
JasonBOCQUET
Frequent Contributor

Oh great, it works very well !

Big thanks for your help.

 

I'm gonna see now if I can integrate this kind of results in a charts to make it more beautiful in term of visualization.

 

 

0 Kudos
JasonBOCQUET
Frequent Contributor

Hi @jcarlson i want to know if it possible to ameliorate the code.

Because we are using this line 

var match_arr = []

 

The result's rendering is like : ["Agence User","FTO User","Workplace User","IT User"]

it's not very aesthetic, i want to set more code around this to make the result more "friendly user"

 

In another case I use a code to retrieve a list of transaction provided by a relationship class, here is the code :

var transactionsinv = FeatureSetByRelationshipName($feature,"SDE.TRANSACTIONS_INV")
var info3 = ''
for (var f in transactionsinv){
    info3 += `<div style='text-align: left;'><span style='font-size: 16px; font-family: Calibri, sans-serif; color: rgb(1, 42, 132);'>
        <b>Date : </b>${DefaultValue(f.TRA_TRIMESTRE,'')} ${DefaultValue(Text(f.TRA_DATE,'Y'), 'Pas de date de transaction recensée')}<br>
        <b>Acquéreur : </b>${iif(isEmpty(f.TRA_ACQUEREUR), "Pas d'acquéreur recensé", f.TRA_ACQUEREUR)}<br>
        <b>Surface : </b>${iif(isEmpty(f.TRA_SURFACE),'Pas de surface rencensée', Text(Round(f.TRA_SURFACE,0),'#,###')+" m²")}<br>
        <b>Montant : </b> ${iif(IsEmpty(f.TRA_MONTANT),'Pas de montant recensé',f.TRA_MONTANT)+ " M€"}<br>
        <br></div>`
}

var newVariable3 = iif(isempty(info3),"Pas de transactions",info3);

HTML += "<p style='text-align: left;'><span style='font-family: Calibri, sans-serif; font-size: 16px; color: rgb(1, 42, 132);'>"+newVariable3+"</span></p>"

 

It is possible to change the line var match_arr = [] to be emancipated from the table side rendering ?

I want to get closer to the rendering that the code above gives me

 

 

0 Kudos