Hoppa till huvudinnehållet

Query last or distinct record

Kommentarer

5 kommentarer

  • John Nerge
    Additional snafu while testing. I'm querying a spatial layer and want to use the resulting feature set to add a new row to a table. But even when the scheme between the spatial layer and the table are identical, it's not working.

     

    I'm using the Add Features activity to do the add to the table, and I can confirm that it does when when adding features from a feature set that was generated by a table.
    0
  • Permanently deleted user
    Hi John, 

     

    If you are looking for the max objectID from a layer for example, then what I would suggest is in the Query Task, specify the "Order By Fields" . Once the features in the feature set are sorted, you can easily grab the first or last item from the feature set using this notation: featureset.Features.First() or featureset.Features.Last()

     

    Once you find the feature you want to add to a data table, you can use the AddDataTableRow activity to insert a new row into the non-spatial table.

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=90760000000TUJN&feoid=Body&refid=0EM60000000Lzs5"_/_img_

     

    The dataTable would be the non-spatial table. The Values parameter is a list of values you want to add to the table. If the column in the feature set is in the same order as your data table, then you can use this notation to add the values:

     

    featureSet.Features.First().Attributes.Values

     

    Otherwise, you would need to manually assign the right column value to the correponding table column using a series of Assign activities like this:

     

    dataTable.Rows(10)("Parcel") = featureSet.Features.First().Attributes("ParcelName")

     

    (https://support.geocortex.com/essentialsGSCCodeGallery?sub-nav=codegall&main-nav=essentials&#!/feedtype=SINGLE_ARTICLE_DETAIL&criteria=BESTANSWERS&id=kA460000000bljhCAA) This article here might help as well if you have a larger feature set to add/merge.

     

    I hope this helps.

     

    Regards, 

     

    Carmen
    0
  • Nico Burgerhart
    To use Order By Fields in a query task your ArcGIS Server version has to be 10.1 or higher.
    0
  • John Nerge
    That .First() .Last()  syntax is a great tip, thanks!
    0
  • Permanently deleted user
    _img_ alt="WorkflowExample" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000kAKN&feoid=Body&refid=0EMf2000000fyn5"_/_img_

     

    Here is how I did this sort of idea but was concerned with Distinct.  The "Value" for the dictionary was: string.Join(",", stringList.Distinct)
    0

Du måste logga in om du vill lämna en kommentar.