|
POST
|
newbreak = [float(i) for i in brkvalues] @DanPattersonIf I use that it gives me: TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'. @Anonymous UserI used float(brkvalues) and set the tool Data Type to Double. The tool ran with no error, but the value I set to a decimal was not changed in the symbology. And yes, I've noticed newbreak = int(float(brkvalues)) doesn't show the decimal places in the symbology either.
... View more
10-19-2021
07:55 AM
|
0
|
1
|
3811
|
|
POST
|
I have a script tool that sets a layer's break values and their labels. The user will also need to enter decimals as values. I can't seem to get the tool to do that. Here I have the break values set to accept a Long data type. I've also tried a double, and a string. The break values entered into the tool are forced to be integers in the script. #class break values
classbreakvalues = sys.argv[1] #break value parameter entered here
breakvalues_list = classbreakvalues.split(";")
new_breakvalues_list = []
for brkvalues in breakvalues_list:
newbreak = int(brkvalues) # integer value
new_breakvalues_list.append(newbreak)
classBreakValues = new_breakvalues_list If I run the following, the tool won't accept a decimal value. I get this error, which I understand to mean you can't have an string as an integer. But I don't see how that could be. ValueError: invalid literal for int() with base 10: '70.5'
... View more
10-18-2021
12:33 PM
|
1
|
8
|
3873
|
|
POST
|
A bunch of changes later I was able to get what I wanted, which is a script that changes the break values of multiple layers in multiple maps using multiple fields. I needed a counter, which until now I only copied but wasn't sure how to use. Also, don't know if this is a bug or not, but you can't give the condition for a GraduatedColorsRenderer if it is already. You have to "reset" the renderer. I was able to do this by changing the renderer to SimpleRenderer then back to GraduatedColorsRenderer. And by not setting a renderer at all I didn't get any results. Also, by remove the save() line it ran much faster. Here's a working script: import arcpy
aprx = arcpy.mp.ArcGISProject('CURRENT')
#make sure fields in list are in same order as maps in project
fields = ['VaccPercentageTotPop', 'VaccPercentage11to14', 'VaccPercentage0to18', 'VaccPercentage12to18',
'VaccPercentage14to16', 'VaccPercentage16to18', 'VaccPercentage19to64', 'VaccPercentage65Plus']
c = 0 # use counter to give a number to each map in for loop
for map in aprx.listMaps():
print(f'--- map: {map.name} ---')
layers = map.listLayers()
for layer in layers:
print(f'layer: {layer.name}')
sym = layer.symbology
#reset renderer
sym.updateRenderer('SimpleRenderer')
sym.updateRenderer('GraduatedColorsRenderer')
if hasattr(sym, 'renderer') and layer.name.startswith('BaseLayer'):
Renderer = sym.renderer
Renderer.classificationField = fields[c]
classbreakvalues = [40, 45, 60, 100]
classbreaklabels = ['0-40%', '41-45%', '46-60%', '60.4%-100%']
Renderer.breakCount = len(classbreakvalues)
i = 0
for brk in Renderer.classBreaks:
brk.upperBound = classbreakvalues[i]
brk.label = classbreaklabels[i]
i+=1
layer.symbology = sym
# aprx.save()
c+=1
... View more
10-15-2021
11:50 AM
|
0
|
0
|
1527
|
|
POST
|
In my Pro project, I have 8 maps with 3 layers each. I'm writing a script that iterates the layers in each map, and changes the break values of these layers. There is one more step where I'd be grateful for some direction. And that is with setting multiple classificationFields. I know how to set the break values using one classificationField, anyway. I'm not sure I'm doing this right, but in order to give each layer its particular classificationField which corresponds to that particular map I've created a list. #create fields list. for every map, change the symbology based on its corresponding field
sym.renderer.fields = ['VaccPercentageTotPop', 'VaccPercentage0to18', 'VaccPercentage11to14',
'VaccPercentage12to18', 'VaccPercentage14to16',
'VaccPercentage16to18', 'VaccPercentage19to64', 'VaccPercentage65Plus'] I'm using sym.renderer.fields because it seems to allow a list, which I'm referencing from this SE post. In the Pro docs I don't see any help with multiple fields. This will throw an error with a list: sym.renderer.classificationField = ... The following script iterates the layers and the maps successfully, but nothing happens to the layers. import arcpy
aprx = arcpy.mp.ArcGISProject(r'\\path to\TestDelete.aprx')
def values():
for map in aprx.listMaps():
print(f'map: {map.name}')
layers = map.listLayers()
for layer in layers:
sym = layer.symbology
if hasattr(sym, 'renderer') and layer.name.startswith('BaseLayer'):
sym.updateRenderer('GraduatedColorsRenderer')
print(f'Updated Graduated colors renderer: {layer}')
Renderer = sym.renderer
classbreakvalues = [40, 45, 56.8, 100]
classbreaklabels = ['0-40%', '41-45%', '46-56.8%', '56.9-100%']
Renderer.breakCount = len(classbreakvalues)
print(f'Set the break count value: {layer}')
#Renderer.classificationMethod = 'Manual Interval'
#create fields list. for every map, change the symbology based on its corresponding field
sym.renderer.fields = ['VaccPercentageTotPop', 'VaccPercentage0to18', 'VaccPercentage11to14', 'VaccPercentage12to18',
'VaccPercentage14to16', 'VaccPercentage16to18', 'VaccPercentage19to64', 'VaccPercentage65Plus']
i = 0
for brk in Renderer.classBreaks:
brk.upperBound = classbreakvalues[i]
brk.label = classbreaklabels[i]
i+=1
layer.symbology = sym
aprx.save()
values()
... View more
10-08-2021
08:22 AM
|
0
|
1
|
1583
|
|
POST
|
Using this video I was able to get what I wanted. https://www.youtube.com/watch?v=CTq-ux2v5ds&list=PLGZUzt4E4O2L7h2PdpL7st93nURZAW58d One thing to note, that I haven't seen in any of the help docs, but was mentioned briefly in the video (but not shown) is that you need to separate columns in your CSV by commas. It may be intuitive to someone who uses Survey123 all the time, but I wasn't familiar with it. And the survey wouldn't work without doing this. In the Data tab of your CSV --> From Text/CSV --> navigate to your CSV in your media folder and select it --> Transform Data --> Close and load. Note: you will have a new header column, labeled as Column1, Column2, etc... I had to use these new column headers in the pulldata() function.
... View more
10-05-2021
01:13 PM
|
0
|
0
|
5464
|
|
POST
|
EDIT: I have the company set to autocomplete in the appearance field and no calculation, and that seems to be working okay. But, I'm still wondering how to use pulldata() to autofill the rest of the contact fields based on the CSV. I'd imagine each of the contact fields would be based off of the company field and would need a calculation something like this: pulldata("contacts_short", " Address", "Address",${company})
... View more
10-05-2021
09:25 AM
|
0
|
0
|
5472
|
|
POST
|
@ZacharySutherby, Thanks for the reply. I read fields are not supposed to refer to themselves, so I'm a little confused as to where to put the calculation. Right now I have everything in the same row (highlighted in yellow), but I get an error in Connect.
... View more
10-05-2021
07:57 AM
|
0
|
1
|
5481
|
|
POST
|
It looks like what I want to achieve can be done, maybe. I have a CSV with company names and addresses. I'm looking for a way to pre-populate the section of my survey where it asks for contact info. The end users will generally be the same companies year after year. I'm designing the survey in Connect and will ultimately publish it as a Web App (v. 3.13). Here's an example of what I mean: (1) The user starts typing the name of the company the begins with "a". A list of those companies show up. (2) When the user selects a company all contact boxes are filled. According to this help doc, you won't be able to fill multiple boxes at one time: The pulldata() function is best kept alone in the calculation column. Do not be tempted to combine multiple pulldata() calls within the same calculation. It will work in Survey123 Connect, but the Survey123 web app will not be as permissive. I've also been referencing this help doc, but I don't quite understand it. pulldata('info','email','name', ${previous_question}) The name of the CSV file that contains the list of values. The name does not include the .csv file name suffix. The name of the column in the CSV file that contains the value you want to return. The name of the key field in the CSV file that you will use to look up the value. The key value to look up in the key field. Looking at the parameters here, I understand what the first two are. What exactly are numbers 3 and 4? I've attached my XLSF and a shortened version of the CSV file (contacts_short.csv) that has the contact info.
... View more
10-04-2021
02:43 PM
|
0
|
4
|
5536
|
|
POST
|
@IsmaelChivite I tried it, yes. But, it's not how I intend the survey to work. The user should have the option to fill out tons as well as cubic yards. It's only when they enter a cubic yards value that the tons value is automatically calculated. To update my reply to @jcarlson's answer: I mistakenly looked at the wrong page of my survey. You might have the solution. There is no spinner, but I get a NaN in the tons box. That's better than a spinner, anyway. And now it's suddenly giving me multiple decimal places when before it was giving none. I'll have to look into that.
... View more
09-29-2021
10:11 AM
|
0
|
0
|
2621
|
|
POST
|
Hi Josh, Thanks for the reply. (1) The user should be able to enter a value for both cubic yards or tons. (2) If the user enters a value in cubic yards it should be automatically calculated to tons. (3) I don't want the user to be able to adjust the tons value. I tried your first suggestion. I changed the type to text and set bind::esri:fieldType as esriFieldTypeInteger. Then I republished. No difference. The "spinner" is still there.
... View more
09-29-2021
09:11 AM
|
0
|
0
|
2631
|
|
POST
|
Hello, In my XLSX form I have a simple calculation on an integer that converts cubic yards to tons. In Survey123 Connect it works absolutely fine. Ultimately, the survey will be used in the web app. Upon testing I noticed you can increase/decrease the value in the tons box on the web app survey. How do I remove this? XLSX form showing calculation: Same elements in Connect: Same elements after publishing to web app. I circled the increase/decrease arrows in yellow: XLSX form is attached.
... View more
09-29-2021
07:30 AM
|
0
|
4
|
2675
|
|
POST
|
Thanks Phil, Ok, thanks for the links. Those are the ones I've been referencing all along. At least I'm not missing anything. I went ahead with the pages layout.
... View more
09-29-2021
06:34 AM
|
1
|
0
|
6492
|
|
POST
|
Note: The theme-grid appearance value is not supported by the Survey123 web app. I found this out the hard way after putting together a fairly large survey with Survey123 Connect. It looked perfectly fine in Connect. But, when I published to the web the theme-grid wasn't supported and the survey didn't look so pretty. I guess it's meant for a mobile device. Is there a way I can do a grid that works with the web app? I'm currently researching Pages to see whether it supports a grid theme. Suggestions would be much appreciated.
... View more
09-28-2021
09:18 AM
|
0
|
7
|
6543
|
|
POST
|
Thanks Doug. That works nicely. I'll keep it like that for now. But, I'd still rather have it where the user can input the tons. I'm not sure if that will even work with the calculation in the Tons fields. Here's an example of your idea put to use: ${asphaltyards}*1.4 goes in the calculation field of Asphalt Tons, which looks like this: EDIT: I set both asphaltyards and asphalttons to integers. Now the user can enter a value in the Tons field, or if they enter Cubic yards the calculation still functions.
... View more
09-23-2021
12:19 PM
|
0
|
0
|
2521
|
|
POST
|
I've been trying to get my survey to resemble the one above. Essentially, you have a group called MATERIALS and nine choices under two more groups (i.e. Recycled Cubic Yards, Recycled Tons). Additionally, if an integer is typed in the Recycled Cubic Yards box it should be calculated to Recycled Tons automatically. But, I'm more concerned with getting the Survey set up right. The closest I've came is putting the group in a table-list. I've also tried the theme-grid style in the Settings tab. But, apparently you can't do both at the same time. I've attached the spreadsheet, but here's a screenshot:
... View more
09-23-2021
10:58 AM
|
0
|
2
|
2555
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-25-2026 12:25 PM | |
| 1 | 05-04-2026 08:45 AM | |
| 1 | 04-20-2026 01:20 PM | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|