2

I am trying to build a web application on ArcGIS online and was wondering if anyone knew of a widget what would allow me to join data from one file to another based on a attribute. I know there is a tool in ArcMap called Add Join tool but I could not find a substitute within Web App Builder.

1
  • 2
    According to this link, building joins is currently not supported in ArcGIS Online. See the answer section.
    – evv_gis
    Aug 9, 2016 at 20:44

1 Answer 1

1

You can build your own custom Join widget with Python and JavaScript.

I built my own custom Join Widget by writing up the join processing script in Python, and then publishing it as a geoprocessing script. I then customized Web App Builder's default Geoprocessing script to reference to the geoprocessing service and customized the user interface to meet the needs of the project.

12
  • Did you python code look like this? import arcpy input_layer = arcpy.GetParameterAsText(0) in_field = arcpy.GetParameterAsText(1) join_table = arcpy.GetParameterAsText(2) join_field = arcpy.GetParameterAsText(3) arcpy.AddJoin_management("input_layer","in_field","join_table","join_field","KEEP_ALL")
    – mkeller
    Aug 16, 2016 at 16:26
  • 1
    Yes, you can use that syntax for the Join geoprocessing. You can remove the quotes from input_layer, in_field, and join_table though since you are storing the parameters as variables. Don't forget to create a parameter for the output and use the SetParameter function to get the join output to display. More info here: link Aug 16, 2016 at 23:05
  • Ifeoma, could you explain this in a little more detail I am confused as to how this work. If you set a parameter for an output such as output = arcpy.GetParameterAsText(4) and use the function SetParameter like so arcpy.SetParameter(1, output) how will that call the data from the join? Maybe I am doing this wrong?
    – mkeller
    Aug 17, 2016 at 15:28
  • Here is my new code: import arcpy input_layer1 = arcpy.GetParameterAsText(0) in_field = arcpy.GetParameterAsText(1) join_table1 = arcpy.GetParameterAsText(2) join_field = arcpy.GetParameterAsText(3) output = arcpy.GetParameterAsText(4) input_layer = arcpy.MakeFeatureLayer_management(input_layer1, "inputlayer.lyr") join_table = arcpy.MakeFeatureLayer_management(join_table1, "join_table.lyr") test = arcpy.AddJoin_management(input_layer,in_field,join_table,join_field, "KEEP_ALL") arcpy.SetParameter(1, output)
    – mkeller
    Aug 17, 2016 at 15:30
  • If the output is parameter 4 for your tool, then you can just do something like this for the output: arcpy.SetParameter(4, output). Assign the output variable to be the final result you want to display in the map before you do SetParameter instead of doing a GetParameter for the output. Aug 18, 2016 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.