I am builder model that users will be able to select values of year in range i.e 5 or 10years interval. The Year picklist will look like this in the tool. How can I do this in ArcGIS model builder ?
I think it is working but it selects alphabetically i.e if I select from April it will select all values of month from A-S, but if I select from January to April, it returns null because J does not come before A.. how can i solve this to make it select January to April or September to December to return a value.@Curtis Price .
Thanks.
I am not well skilled in python...it would be best to it in modelbuilder if possible..Thanks
Filter—ArcPy classes | ArcGIS Desktop
if i understand your question...Yes
A value list filter for the parameter?
I think it is working but it selects alphabetically i.e if I select from April it will select all values of month from A-S, but if I select from January to April, it returns null because J does come before A.. how can i solve this to make it select January to April or September to December to return a value.
Curtis Price I did as you instructed and it worked, but however i did same for Months in the year i.e instead of using YEAR, I use MONTH
<SPAN style="border: 0px; color: #000000; background: rgba(255, 255, 255, 0.5); font-weight: inherit; font-size: 14px; ">MONTH </SPAN><SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;">>=</SPAN><SPAN style="background-color: #f5f2f0;"><SPAN style="color: #000000;"> </SPAN><SPAN style="color: #990000;">JANUARY</SPAN></SPAN><SPAN style="background-color: #f5f2f0; color: #000000; "> </SPAN><SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;">AND</SPAN><SPAN style="background-color: #f5f2f0; color: #000000; "> MONTH </SPAN><SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;"><=</SPAN><SPAN style="background-color: #f5f2f0;"><SPAN style="color: #000000;"> </SPAN><SPAN style="color: #990000;">APRIL But it shows empty output, what could be wrong? or it can only be used for numeric but not text or what could be the issue?</SPAN></SPAN>
You could create a text string variable, set it as a parameter, and in the Model Options parameters, use a filter to create the list of choices.
Then use the Calculate Value tool to convert that string to a SQL expression, like this:
<SPAN class="string token">"YEAR >= {} AND YEAR <= {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"%Year Range%"</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"%Year Range%"</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
The above expression would yield for your first choice "1967-1971":
YEAR <SPAN class="operator token">>=</SPAN> <SPAN class="number token">1967</SPAN> <SPAN class="operator token">AND</SPAN> YEAR <SPAN class="operator token"><=</SPAN> <SPAN class="number token">1971</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.