Problem with Compute() method
I have a featureset that I've converted to a datatable, dtPole using the 'featureset to data table' activity. I would now like to use the Compute() method on that datatable to count based on filters.
Here's what I have in my workflow.
Assign: strExpression = "COUNT(OBJECTID)"
Assign: strFilter="PROJECTAREA = '" + strProj + "' AND CONDITIONRANK = '" + strRank + "' AND POLECONDITION = '" + strCond + "'"
InvokeMethod: 'Compute' on dtPole with just two input parameters: strExpression and strFilter. The result is returned in the object variable objCompute.
I get an error:
Invalid usage of aggregate function count() and type object.
I've also tried this simpler way, which does the same thing, but it also gives the same error:
Assign: objCompute = dtPole.compute(strExpression,strFilter)
I've tried with strFilter='' and get the same error, so the filter is not the issue.
I've also tried it with other columns, eg. COUNT(LATITUDE) where LATITUDE is a 'double' data type and I know this because I created this column manually in the featureset. I get the same error message regardless of which column I use.
Any ideas?
Thanks
Mark
-
Mark,
I am just attempting the same thing and getting the same error. Were you ever able to figure this out? Is the Compute Method not available in workflow?
Thanks,
Kathy0 -
I think you should use 'Invoke Method' activity: TargetObject as [Your DataTable], Method Name as [Compute], and two Parameters for Expression and Filter as the input arguments for Compute Method (https://msdn.microsoft.com/en-us/library/system.data.datatable.compute(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2)
Good luck!0 -
Thank you Munwhan, but I have tried that approach and receive the same error that Mark shows in his initial post. 0 -
Munwhan,
Thank you for the help! That makes sense, unfortunately I can't see the activity between FeatureSetToDataTable and InvokeMethod. When I load into Workflow Designer it shows an error in place of that activity "Activity coud not be loaded because of error in the XAML". Maybe this is due to us using an older version of Workflow Designer, as I don't see an activity for AddDataTableColumn.0 -
This activity was new in Essentials 4.4. 0 -
Thank you Nico. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
6 Kommentare