Select to view content in your preferred language

Inline Variable Sub to output Feature Class Name

763
1
09-07-2023 05:42 AM
AngelaStrongarm
Emerging Contributor

Calculating the date in YYYYMMDD format as the first step in my model for all of my output Feature Classes to have that at the end of their name. I use the Calculate Value tool to get the Variant YYYYMMDD and I am trying to pass it to multiple output FCs throughout the model. 

This shows how I calculate the %DATE% variable-

AngelaStrongarm_0-1694090283882.png

I set the Calculate Value took as the Precondition for the next step, which is here- I try to add the variable sub to an output FC name (Parcels_%DATE%), it tells me that it Contains Invalid Characters-

AngelaStrongarm_1-1694090413828.png

I feel like I have got to be missing something pretty obvious, either that or completely misunderstanding the use of the inline variable subs. Any help/ideas are appreciated!

***I do understand that I can skip the Calculate Value and just use the built-in variable sub %t%, but I prefer the date format I've chosen using the Calculate Value tool. 

0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor

Your script logic looks sound but its how you are reference the inline variable that is the issue.

Your calculate value tool - don't name its output with 1) a database reserved word and 2) with %% around it. Call it something like myDate.

If you had renamed the output to %bob% then you would need to reference it as %%bob%%.

 

0 Kudos