Page 1 of 1
Passing string constants through a data file
Posted: Fri Feb 12, 2021 4:50 pm
by rob_n
Hi,
I can pass string constants through a .cin file. But when I am interested to use only a subset, I get errors like
"Too many values or unrecognizable value format" and
"bad type, incorrectly subscripted or not found".
I'd like to avoid .cin input errors by having all model data, including string constants in a .vdfx data model.
Are string constants save to a .vdfx file? Can string constants be read in from a .vdfx file?
Best regards,
Rob
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 4:52 pm
by rob_n
Here are two example models that show the problem.
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 4:59 pm
by tomfid
I think data i/o only works for numeric values. Strings would have to be in a .cin.
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 5:06 pm
by Administrator
String variables are stored in the VDFX file. I think the only way to get them would be a new function like "GET STRINGVAR FROM VDFX FILE" as you cannot define a data variable to be of type string.
I'll add it to the list of things to do.
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 5:14 pm
by tomfid
What's the use case for this?
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 5:42 pm
by rob_n
The application is supply chain for raw materials. There are ~1600 finished goods, and ~7300 raw parts. Since the FG and raw part names are long and awkward, I'd rather define subscript names in a convenient way,
FG : (f1-f600) and
part: (r1-r7300)
Since I cannot remember what part number r4545 is, I want to put a string in the plot title, e.g. \rname[r4545]/
So there string constants with the names of the finished goods and part numbers, fname[FG], rname[part]. These are long, and don't change, so I don't want to have to mess with them very much.
Since the model ends up being large (read: slow), I'd like to test it out with only a few finished goods and their complete bills of materials. I do this by
FG: f140,f256,f1234
But when I pass the string constants in the .cin files, I get errors for all the subscripts that are no longer defined.
The only way I can see to do this now is to make new .cin with only the subset of finished goods and part numbers (which makes it somewhat harder to construct the test case, but is doable).
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 8:58 pm
by Administrator
rob_n wrote: ↑Fri Feb 12, 2021 5:42 pmBut when I pass the string constants in the .cin files, I get errors for all the subscripts that are no longer defined.
Are they errors or warnings? We changed the behaviour some time ago so that if an error was encountered, you could still contine.
Re: Passing string constants through a data file
Posted: Fri Feb 12, 2021 11:24 pm
by tomfid
One other option: use GET XLS SUBSCRIPTS or the GET DIRECT equivalent to define them.
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 4:15 pm
by rob_n
Administrator wrote: ↑Fri Feb 12, 2021 8:58 pm
rob_n wrote: ↑Fri Feb 12, 2021 5:42 pmBut when I pass the string constants in the .cin files, I get errors for all the subscripts that are no longer defined.
Are they errors or warnings? We changed the behaviour some time ago so that if an error was encountered, you could still contine.
The messages are errors.

- Picture1.png (749.94 KiB) Viewed 13472 times
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 4:48 pm
by Administrator
Try
pname[p3] :is: 'Third'
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 4:52 pm
by tomfid
Right - the syntax should be the same as an equation: = for numbers, :is: for strings.
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 6:57 pm
by rob_n
I get basically the same result.
I should have mentioned that the .cin file for my test had three elements. Only the element in the .cin file but not in the model causes the error. Sample model and both .cin files attached.
Best regards,
Rob

- Picture2.png (745.7 KiB) Viewed 13454 times
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 6:59 pm
by rob_n
Here's the second .cin file
Re: Passing string constants through a data file
Posted: Sat Feb 13, 2021 7:20 pm
by tomfid
The model has
part : (p1-p2)
so the error for p3 is expected.
However, we can downgrade it to a warning so that it still runs.