Skip to main content
deleted 30 characters in body; edited tags; edited title; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

conect Connecting GetParameterAsText with a Pick List?

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks right now like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

Edit: This This is how my Parameter Panel looks right now:   

Pic1

conect GetParameterAsText with a Pick List

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks right now like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

Edit: This is how my Parameter Panel looks right now:  Pic1

Connecting GetParameterAsText with Pick List?

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

This is how my Parameter Panel looks: 

Pic1

added 128 characters in body
Source Link

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks right now like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

Edit: This is how my Parameter Panel looks right now: Pic1

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks right now like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

I am sitting here already awhile and can't find an answer on my own. I actually have pretty much the same Problem which was already asked (MultiValue-String to SQL Expressions). But mine is more basic because of missing knowlegde. I tried to use the codechunk out of the other Problem but when i run it the expected Pick-List is always without Values. Some Basic Questions actually include missing comprehension of the functions.

multival = arcpy.GetParameterAsText(1)  # 'Store_1;Store_2;Store_3'
vals = multival.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
where = where_stub.format(stores)

I actually don't know where the multivalcomes from and which Position its claimimg in the code. Maybe for a better understanding my task is to create a Route for a Pizza delivery with about 6 Stops. As data I got a file with 25 Stores which from I should pick various stores. To avoid a SQL-Expression I would like to have a Pick-List as in the other Problem shown (MultiValue-String to SQL Expressions).

My Code looks right now like this

# Import arcpy module
import arcpy
from arcpy import env
 
#workspace =  GetParameterAsText (0) ???
arcpy.CheckOutExtension("Network")

# Local variables:
in_network_dataset = "Transportation/Streets_ND"
outNALayerName = "BestRoute"


# Process: Make Route Layer
arcpy.MakeRouteLayer_na(in_network_dataset, outNALayerName, "TravelTime", 
"FIND_BEST_ORDER", "PRESERVE_BOTH", "", "", "ALLOW_UTURNS", 
"Oneway;RestrictedTurns", "", "", "", "")

# Process: Select
Stores = "Stores.shp"
Stores_Select = "Stores_Select_Output"
Expression = arcpy.GetParameterAsText(0)
vals = Expression.split(";")

where_stub = """"NAME" IN ({})"""
stores = ','.join(["'{}'".format(x) for x in vals])
Expression = where_stub.format(stores)


arcpy.Select_analysis(Stores, Stores_Select, Expression)

It will execute until the select-process but then it does not make a difference between my script and a totaly empty one... Can Someone explain me how to get the Parameters into my Pick-List and maybe some Ground explanation so i understand what the Codechunk from (MultiValue-String to SQL Expressions) includes?

Edit: This is how my Parameter Panel looks right now: Pic1

edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Source Link
Loading