Hi Brains Trust. I thought this was a simple thing, but I can't quite figure it out. I want to be able to enter multi-line text into a Models string parameter, but it seems to only accept single line of text. Destination will be a string field in a feature class.
LindsayRaabe_FPCWA_0-1646968710732.png
LindsayRaabe_FPCWA_1-1646968748550.png
There is multivalue, but not multiline (same in modelbuilder)
Setting script tool parameters—ArcGIS Pro | Documentation
I suspect you want a "textbox" rather than a "textline" to display the full text of field entry
I assume text boxes are not an option?
Could a text file work in place of a text line/box?
Ugly workaround - use a "SQL Expression" datatype...?
unnamed.png
Thanks for the suggestion. I've had a look at that now and don't think that's really a viable option. Would it be possible to load the text in a text file (using the Text File variable) and use a python code to extract the text and calculate field?
I feel like I'm getting closer - but still need guidance. I've created a Calculate Value Code Block as per below but have 2 problems (at least, 2 for now):
LindsayRaabe_FPCWA_1-1646981665049.png
LindsayRaabe_FPCWA_2-1646981743283.png
1. I can't figure out how to replace the written file path on line 4 with the pathway from the variable (which is a text file) i.e. path = (str_path). When I do, I get the below error.
LindsayRaabe_FPCWA_3-1646981841268.png
2. When I run it successfully as per the original script, the output Value is still blank (at least as far as I can tell).
LindsayRaabe_FPCWA_4-1646981919230.png
unnamed.png
Nearly worked! It did indeed calculate the Value as you suggested (just using the Expression instead of the code block) but the calculate field step failed where it encountered the new line.
LindsayRaabe_FPCWA_0-1647304974656.png
Trying to fix the issue by turning the multiline text file into a single, long string. Started a new expression as per below, but the Code block keeps removing the \n and just moving the text onto a new line.
LindsayRaabe_FPCWA_0-1647310915500.png
becomes this:
LindsayRaabe_FPCWA_1-1647310923957.png
So I tried this too:
LindsayRaabe_FPCWA_2-1647310952453.png
but get this error:
LindsayRaabe_FPCWA_3-1647310963104.png
which is the same error I get from just running the field calculator with the original multiline text value. So frustating!
Leave your new lines/ carriage returns in and just wrap in triple quotes instead of single quotes in the calculate field expression. String literals inside triple quotes, """ or ''', can span multiple lines of text.
r"""%Value%"""