Aller au contenu principal

Workflow run operation: results.convert-to-xls -- can you add "fields" not in results?

Commentaires

9 commentaires

  • Andy Swift

    Hi Carmen,

    Two ideas come to mind that would save you from having to add fields and calc static values.  If it's in an RDBMS, it's easier/faster probably to make a  view on top of the featureclass and publish that into the webmap.  Or you could try directly in workflow in javascript maybe like this : 

    // Assuming 'features' is your input feature set const staticValues = { CitySt: "Greenville, SC", Recipient: "Greenville Neighbor" }; features.forEach(feature => { feature.attributes.CitySt = staticValues.CitySt; feature.attributes.Recipient = staticValues.Recipient; });

    //After adding the static fields to each feature, you can include these new fields in the outFields parameter

    { features: $opCreateGraphics.result, outFields: [ "FULLADDRESS", "UNITTYPE", "UNIT", "ZIPCODE", "CitySt", // New static field "Recipient" // New static field ], includeHeaderRow: true, sheetName: "AddressesForMailing", geometryFormat: "NONE" }

     

    0
  • Carmen Durham

    Thank you, Andy, for your suggestions and potentially a verification that I would have to add to the workflow in some manner.  

    In this case, I cannot make use of a RDBMS/SQL View (I have done that before in separate situations).

    Thanks,

     

    0
  • Carmen Durham

    As I look closer at Andy's reply, I do not know how to “apply javascript directly in the workflow. ”.  I tried to find how to do this, but I am obviously missing something.  Please share any links to explain what Andy mentions.

    So, to try reverting back to the original plan. I went back to the old GCE Workflow as a reference and tried to mimic the process using Studio Workflow which uses the following steps. I have run into the following questions in bold italic:

    1.  converting the featureset to a data table using FeatureSetToDataTable Activity- Where is the equivalent activity in VertiGIS Studio?  Is it present and I cannot find it?  Why is there a Remove Feature Set Fields but not an Add Feature Set Fields????
    2. Using “Invoke Method” Activity to add the fields - Hmm.  I noticed Invoke Method is a Common Server Activity in GCE Workflow. Is this possible in VertiGIS Workflow??
    3.  cycle through records and use “Assign” activity to assign the values to the new fields - 
    4. Run DataTableToXLS activity to export to Excel - I have this part working

    Thank you for reading.  

    0
  • Andy Swift

    To clarify with a caveat, I'm not certain, still learning workflow myself.  I've done more programming than VSW workflows, so I'm not certain we can set a variable staticValues, then reference the rows with features.forEach, or not.  I don't have a working example but I will experiment with it too. 

    0
  • Carmen Durham

    Thank you for the clarification because I sure wasn't finding a way to do what you mentioned!   Yes, in theory, I know exactly what I need to do.  The process works well in Geocortex Essentials workflow but I cannot find the equivalent activities in VertiGIS Workflow to end up with an .xlsx with two additional columns. It is the last item needed to finalize a long workflow to create a mailing list in excel or Avery label format of addresses meeting a bunch of criteria. So close.

    I have mailing labels portion of the workflow running as expected because I could use Reporting Designer to add the Recipient and City,State  to the label manually.

    Have a great weekend.

     

     

     

    0
  • Andy Swift

    Hi Carmen, I practiced with the ForEach looping through to append static values.  It might work to update a collection.  Here is an example making a string : 

    = $forEach1.item.attributes.OBJECTID + ', ' + $forEach1.item.attributes.address + ', Greenville, SC' + ', Greenville Neighbor' 

    0
  • Berend Veldkamp

    You can add arbitrary fields to an esri graphic object using the Set Feature Attribute activity; the name does not need to exist yet. 

    So for instance, if your data comes from a Query Layer, use a For Each to loop over the resulting features, and inside that, add two Set Feature Attribute activities, one for City and one for Recipient

    2
  • Andy Swift

    Thanks for that Berend.  That works.  Here is a simplified example workflow exported to json, adding two static fields with values into a query result.  This workflow methodology absolutely takes some practice and familiarity. 

    https://www.dropbox.com/scl/fi/e03dbq9bq934zctsz53ev/test-add-staticfields.json?rlkey=7db28i4q7t5j1v63hc9vejjyl&st=sux0ia54&dl=0

    0
  • Carmen Durham

    Berend,

    Thank you for your comment, especially the first sentence and the text I put in bold and italics below:

    You can add arbitrary fields to an esri graphic object using the Set Feature Attribute activity; the name does not need to exist yet

    I would not have thought that the  Set Feature Attribute activity would allow you to “create a new field” based on the VertiGIS Workflow documentation.  The documentation had me to believe that the attribute had to exist before you could set a value.  There is no mention that you can use this activity to “create and/or set an attribute”

    So, thank you for clarifying because with your comment and suggestion, I have the export to xlsx working as I wanted to include extra static fields. Hooray!!!!!!

    Carmen

    0

Vous devez vous connecter pour laisser un commentaire.