List of strings

I’ve been trying to create a list of strings to name load cases in a loop.

However, it would seem that it’s not possible to interact with a list of strings after it’s created, is that really true?

Please see the example code piece below:

+prog template
    head List of strings

    let#list1 1,2,3
    prt#list1

    let#list2 'A','B','C'
    prt#list2

    let#list3 #list1(:)
    prt#list3

    let#list4 #list2(:)
    prt#list3
end

Hello,

If you want to increase the title of an load case set, try to use the following code snippet. The first short code creates a load case with the title “2C”.

LET#list1 'A','B','C'
LET#list2 '1','2','3'
LC 1 DLZ 1.0 TITL #list2(1)#list1(2)

Or you work with an increasing variable name:

LET#lf 2
LET#s1 "loadcase #(lf,3)"
PRT#s1

Best regards
Frederik Höller
Your SOFiSTiK Support Team

thank you for your reply. Even though you have now edited your reply, I hope you will still let the responsible developer know about this issue.

Meanwhile, I’ll do the workaround.

Hello,

I have informed the responsible developer but due to the lack of necessity, the program behaviour is not changed.

Best regards
Frederik Höller
Your SOFiSTiK Support Team

Okay, I’d say that debugging your software is rather necessary, but I suppose priorities do vary.
Furthermore I’d suggest increasing the allowable string length to more than 8 characters as well.

But I consider the thread closed for now.

Thank you.

While we are at the topic of Let-variables and their implementation:
There seems to be a difference in how whitespace is treated whether the type is a string or a numeric value.

The assignment to #list3 has a bug in it (inserting blanks in the vector).
Also: Are you supposed to be able to swap commas for whitespace?

Example input:

let#list1 ‘A’,‘B’,‘C’
let#list2 1,2,3
prt#list1
prt#list2

let#list3 ‘A’, ‘B’, ‘C’
let#list4 1, 2, 3
prt#list3
prt#list4

let#list5 ‘A’ ‘B’ ‘C’
let#list6 1 2 3
prt#list5
prt#list6

Corresponding output:

LET#LIST1 ‘A’,‘B’,‘C’
LET#LIST2 1,2,3
PRT#LIST1
CADINT VARIABLE LIST1 ( 0) = "A "
CADINT VARIABLE LIST1 ( 1) = "B "
CADINT VARIABLE LIST1 ( 2) = "C "
PRT#LIST2
CADINT VARIABLE LIST2 ( 0) = 1.000
CADINT VARIABLE LIST2 ( 1) = 2.000
CADINT VARIABLE LIST2 ( 2) = 3.000

LET#LIST3 ‘A’, ‘B’, ‘C’
LET#LIST4 1, 2, 3
PRT#LIST3
CADINT VARIABLE LIST3 ( 0) = "A "
CADINT VARIABLE LIST3 ( 1) = " "
CADINT VARIABLE LIST3 ( 2) = "B "
CADINT VARIABLE LIST3 ( 3) = " "
CADINT VARIABLE LIST3 ( 4) = "C "
PRT#LIST4
CADINT VARIABLE LIST4 ( 0) = 1.000
CADINT VARIABLE LIST4 ( 1) = 2.000
CADINT VARIABLE LIST4 ( 2) = 3.000

LET#LIST5 ‘A’ ‘B’ ‘C’
LET#LIST6 1 2 3
PRT#LIST5
CADINT VARIABLE LIST5 ( 0) = "A "
CADINT VARIABLE LIST5 ( 1) = "B "
CADINT VARIABLE LIST5 ( 2) = "C "
PRT#LIST6
CADINT VARIABLE LIST6 ( 0) = 1.000
CADINT VARIABLE LIST6 ( 1) = 2.000
CADINT VARIABLE LIST6 ( 2) = 3.000

I appreciate that you both are testing the software so thoroughly.
But in this case you are expecting functionalities that are not programmed for this use case.
As far as I know, string arrays should not be used. Just use one combination of literals for one Variable.
For example

LET#TEXT ‘Hello world’
and not
LET#TEXT ‘Hello’,’ world’

The behaviour of the string array in your short example is interesting, but I can’t explain why you get these results. Just stay away from string arrays :wink: