Select to view content in your preferred language

GUID/Related Table Question for Existing Data

1808
14
Jump to solution
03-28-2022 12:14 PM
Labels (1)
KamillePreto
Occasional Contributor II

I have an existing Dashboard with Construction data on it. I've encountered a lot of issues with this data specifically where the data would just go corrupt suddenly and the dashboard would be unavailable. I've had to re-build this dashboard multiple times over the years, and recently, I just re-created the data from scratch to see if it would resolve the reoccurring issues.

Now that everything is resolved (yay!)... long story short, I don't want to modify anything unnecessarily, especially if it sends my data into a tailspin again. So here is my question.

The intention of this dashboard is to see where our money is spent on Construction. The data is formatted by Funding Source, as you can see below. Many projects span multiple municipalities, so I have one field that just lists them out so they can be displayed on the pop-up.

Recently, an Administrator asked if we could display this data (in another dashboard) by Municipality. So think of bar charts rather than the $$ boxes. However, the data is not set up to display this currently, since the Municipal field I have just lists them out.

What is the easiest way to go about this? Like I said, I don't want to unnecessarily edit the data unless I have to. In the past, someone helped me add a Related Table and I took each construction project's GUID and entered it into the Related Table and typed the municipality there. But that was an older dataset, and I didn't think we needed it this time around.

Construction1.JPG

If you're still reading, thanks for sticking around. I could really use the help on this one. The GUID/Related Table concept is really confusing for me. If there's an easier way, I'll take it!

0 Kudos
14 Replies
KamillePreto
Occasional Contributor II

Thank you again!

How about my other question from my last comment? I'll post it here:

A side note: I also will need to add something in the code that basically says to only include features that fall under our "Status" Domain as: Planning, In Design, and In Construction. We also have Substantial Completion, Final Completion and Closed with Finance that are considered "completed" projects, and will not be on this bar chart. I think I'll need to have two charts - one for the first 3 categories, and another for the last 3 categories. Hopefully this makes sense. I basically need to query the data for the bar chart to only include specific categories of projects.

0 Kudos
jcarlson
MVP Esteemed Contributor

Got it. To include that attribute, you just need to have it piped into the output dicts.

First, make sure that your status is one of the requested fields in your FeatureSetByPortalItem function. I'll assume the field is named "Status" for the rest of this.

Next, when you are iterating over the fs object and splitting, include the status as one of the attributes:

feat = {
    'attributes': {
        'split_choices': Trim(split_array[i]),
        'status': f['Status'] // or DomainName(f, 'Status'), if there's a real domain on it
    }
}

 

In order to hold that attribute, you'll also need to define a field in the choicesDict object:

var choicesDict = {
    'fields': [
        {'name': 'split_choices', 'type': 'esriFieldTypeString'},
        {'name': 'status', 'type': 'esriFieldTypeString'}
    ]

 

Finally, include the status as one of your grouped fields in the final GroupBy function.

// Return featureset after grouping by hazard types.
return GroupBy(
    fs_dict,
    ['split_choices', 'Status'],
    [{name: 'split_count', expression: 'split_choices', statistic: 'COUNT'}]
);

 

In your chart settings, you'll still be able to tell it to group the features based on the split_choices field, but you can split each series by the status, or even filter your data based on the status field. That way you'll be able to use the same data expression for each of those charts. 

- Josh Carlson
Kendall County GIS
0 Kudos
KamillePreto
Occasional Contributor II

Thank you Josh.

Again, data expressions are totally new for me. This is like looking a foreign language almost. I understand it a little bit from some sql I've done in the past. But anyway, I think I put in everything that I need. Do you mind looking it over and telling me if I'm missing anything? It says there's unexpected string in Line 23 (parse error), and there's also an "x" on line 32. So I must've done something incorrectly.

I've done screenshots this time. Sorry I can't get it full screen.

DataExpression1.JPGDataExpression2.JPGDataExpression3.JPG

It also told me yesterday that our Portal URL was incorrect, which it's not. So I need to figure that out as well.

0 Kudos
jcarlson
MVP Esteemed Contributor

By the way, there's a little "code expression" button here if you expand the toolbar:

jcarlson_0-1649082764061.png

 

Anyway, the problem with line 32 is that your fields array should have a comma between each item. Line 31 ends without a comma, so there's nothing telling the expression that the two lines are different items in the array. Line 22 likewise needs a comma at the end.

If it's complaining about your Portal URL, I'd just make sure that you're using the same web address that goes to your GIS portal. It often (but not always) ends with /portal.

- Josh Carlson
Kendall County GIS
0 Kudos
KamillePreto
Occasional Contributor II

Hi Josh,

I want to thank you again for all of your help and time on this question. I just wanted to touch base to see if you've had a moment to review my last comment. No rush, I'm just hoping to try and get this new dashboard launched by May.

0 Kudos