Select to view content in your preferred language

Dashbaord Arcade Expression merge in a new column 3 fields of same table.

1217
0
01-02-2023 05:12 AM
Labels (1)
DoZ
by
Regular Contributor

Hi everyone and Happy New 2023!

I need your help!! I have a table with name, last name and birthday date when the person will turn 18, as well as when they will celebrate their 20th and 30th birthdays:

Name

Surname

18th birthday

20th birthday

30th birthday

Carla

Smith

18/12/2023

18/12/2025

18/12/2035

John

Roswell

22/08/2023

22/08/2025

22/08/2035

Tina

Turner

01/11/2024

01/11/2026

01/11/2036

 

In my dashboard I need to set a date filtert to know who is going to have birthday in the current month. Since the date filter cannot look up different columns, I need to reorder the table and have a unique birthday column. It should look something like this:

Name

Surname

Birthday

Carla

Smith

18/12/2023

John

Roswell

22/08/2023

Tina

Turner

01/11/2024

Carla

Smith

18/12/2025

John

Roswell

22/08/2025

Tina

Turner

01/11/2026

Carla

Smith

18/12/2035

John

Roswell

22/08/2035

Tina

Turner

01/11/2036

 

This way I can use the Dashboard´s date filter on the column „Birthday“.

Could anyone of you suggest me how do I manage this with a Arcade Expression?

A very important plus would be that I would also keep track of what type of birthday the person is celebrating. The table should look like this:

Name

Surname

Birthday

Birthday Type

Carla

Smith

18/12/2023

18th Birthday

John

Roswell

22/08/2023

18th Birthday

Tina

Turner

01/11/2024

18th Birthday

Carla

Smith

18/12/2025

20th birthday

John

Roswell

22/08/2025

20th birthday

Tina

Turner

01/11/2026

20th birthday

Carla

Smith

18/12/2035

30th birthday

John

Roswell

22/08/2035

30th birthday

Tina

Turner

01/11/2036

30th birthday

 

I know I need to create a new dictionary, but I don't know how to tell the function to include all birthday columns and the birthday type...please help!

I only manage this... 😑

var fs = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), 
'a1d6832cc8464d0dab18e582c6e6b6c4' , 0, ['Name','Surname','18th birthday','20th birthday','30th birthday'], false)


// Dictionary to hold list of rounded birthdays
var BirthdayDict = {
    'fields': 
        [{ 'name': 'Name', 'type': 'esriFieldTypeString'},
        { 'surnaname': 'Surname', 'type': 'esriFieldTypeString'},
        { 'name': 'Birthday', 'type': 'esriFieldTypeDate'}
        ], 
        'geometryType': '', 
        'features': []};

var index = 0;       
        
 for (var feature in fs) { 
    BirthdayDict.features[index++] = {      
         'attributes': {
         'Name': feature['Name'],
         'Surname': feature['Surname'],
         'Birthday': feature['18th birthday'----??????],
         'BirthdayType':feature[????]
         }
        
    }};
    
// Return dictionary as a featureSet. 
return FeatureSet(Text(BirthdayDict));         

 

0 Replies