Mailing list: merging columns
What is the best way to merge columns for a mailing list? I've used a Query Layer activity to query the property layer. Using the folio numbers from the results I've then queried the owners table and using the house_id queried the address table to get the civic addresses of the properties. What I want to do is present this list of owners to the user along with the civic addresses as an additional column. (Some of the civic addresses will be repeated because there will be several owners for some properties.) The user will then export this set of results to Excel using the HTML5 Viewer's out of box tool (or my workflow could do the export to Excel if that's easier).
What is the best way to do this in Workflow 5? Convert each featureset to a data table then merge them together (as I did in Essentials Workflow 4), or do this with a collection or is there some better way?
-
The datatable is a class in a .NET library that javascript frankly has no use for, so you won't be converting to that. I am not entirely clear on what you are looking for here, but think that the featureSet class will work best.
To be clear, I think that you...
- have: an address featureset and related owner records
- want: to display owner attributes info with the addresses
If that is all, I would:
- iterate your address featureset
- select related owner records
- concatenate the owners (i'd use array.from() for this)
- put the owners into the featureSet attribute of your choice (you can create attributes on the fly)
- display the data to the user as desired
0 -
^For clarity, when I say "select" I mean using something like array.filter() on your existing query results, not to execute another query.
0 -
Great, this is a very helpful response. This may be a stupid question but how do you call a method on an object? If I want to create new attributes on the fly I understand I could iterate through each featureset feature and for each one call the attr() method on the esri.Graphic object. We have a Create Value and a Set Property activity in Workflow 5 but there is no Invoke Method activity.
0 -
I have found a way to do this. The Set Feature Attribute activity is normally used to set the value of a feature's existing attribute. However it can also be used to add a new attribute to a feature. If I set the Attribute Name to the name of an attribute that doesn't exist, then a new attribute will be created and given the Attribute Value. I should be able to use this to add the 'Civic Address' column to the Owners table.
0 -
Generally speaking, to execute a method on an object I'd use the Evaluate Expression activity; the L-side would be the object and the R-side is the execution expression e.g. "feat.attributes.asdf = feat.attributes.asdf.toUpperCase()"
In your case, I would do something like "featAddr.attributes.Owners = fsOwners.Features.Filter( featOwner => featOwner.attributes.PIN == featAddr.attributes.PIN ).Map( featOwner => featOwner.attributes.OwnerName.toString() ).Join(', ')"
This of course is doing a few things in one expression, which you could break into its constituent parts using the builtin activities like ForEach if you prefer. If you'd like a primer on the array functions above, we like this article in house.
0 -
Those JavaScript functions look really useful. I'll likely have to use a ForEach activity because my joins are so complex. I want to return a full list of owners so that will be the main table of my results sent to the user. That is joined to the Parcels layer via folio, which in turn is joined to the lookupaddress table via RDNID which in turn is joined to the addresspoints layer via HouseID. From this addresspoints layer I'll then retrieve the CivicAddress, whose value will be used to populate the new CivicAddress attribute of the Owners table, which I will be creating and populating in the workflow.
0 -
This has worked. I've used a ForEach activity over the Owners feature set within which I've created some Create Value activities to retrieve the RDNID, then the house id then the civic address, eg.
=$queryMailing2.features.filter(parcel => parcel.attributes.FOLIO_NUMB == $eachOwner.item.attributes.Folio)[0].attributes.RDN_ID
I've then created a Set Feature Attribute activity to add a Civic_Address attribute to the Owners feature set.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
7 kommentarer