Select to view content in your preferred language

Multiply with a field in another table in Arcade

478
2
Jump to solution
06-28-2023 06:01 AM
PetronellaHauptmann1
New Contributor II

Hi.

So I'm trying to create a forecast on how many kids there will be in an area for the next 10 years. I'm using attribute rules and multiply with a coefficient.

The Arcade-script looks like this and works as it should.

var year = $feature.ForegandeAr * Pow(0.993608803, 1);
return Round(year)

The thing is - the value 0.993608803 will change once or twice a year and it appears in a lot of attribute rules. I would therefore like that value (0.993608803) to be taken from another table where I can change it and it changes all the values in all attribute rules. But I don't know how. Can someone please help? Should I make a relationship class? Or a database view? How do I write it in Arcade? Or how can I solve this?

I've attached my gdb if someone needs it. 

Thankful for your help!

 

0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor

I have a stand alone table in the same database that I use for this kind of thing.

var tbl = FeatureSetByName($datastore,"InputTable",['Coeff'], False); 
var feat = First(tbl)
var year = $feature.ForegandeAr * Pow(feat.Coeff, 1);

return Round(year)    

I grab the table and the field that I have populated with the value (in this case, 'Coeff').

Grab the fist row in that layer (even though there is only one (any other needed values are their own column)).

Use the value of the feat.Coeff field in the Pow() function.

R_

View solution in original post

0 Kudos
2 Replies
RhettZufelt
MVP Notable Contributor

I have a stand alone table in the same database that I use for this kind of thing.

var tbl = FeatureSetByName($datastore,"InputTable",['Coeff'], False); 
var feat = First(tbl)
var year = $feature.ForegandeAr * Pow(feat.Coeff, 1);

return Round(year)    

I grab the table and the field that I have populated with the value (in this case, 'Coeff').

Grab the fist row in that layer (even though there is only one (any other needed values are their own column)).

Use the value of the feat.Coeff field in the Pow() function.

R_

0 Kudos
PetronellaHauptmann1
New Contributor II

That works great! Thank you!

 

0 Kudos