 # Classifying lists based on a parameter

I have three lists
List 1: A list of Class Values
List 2: A list of Load Values
List 3: A list of what cross section to adopt for each load value

the problem is:
For each Class Value there is a specific List of Cross Section Values based on Load Values

but i’m facing a problem… I can’t find a way to do that.

I Hope that somebody can help me

Thank you

What happens when you put a watch node on the third output of the cross section codeblock?

I get the list wich is under the cross section Code Block

I already tried to change lacing to longest but it didn’t work @ramoon.bandeira See if this works

``````def class132(l:var[]..[])
{
return=l<=17.5?1.5:(l<=24?2.5:(l<=32?4:(l<=41?6:(l<=57?10:(l<=76?16:(l<=101?25:(l<=125?35:50)))))));
};

def class232(l:var[]..[])
{
return=l<=23?1.5:(l<=31?2.5:(l<=42?4:(l<=54?6:(l<=75?10:(l<=100?16:(l<=133?25:(l<=164?35:50)))))));
};

cs=(cv==1.32)<1>?class132(l)<2>:class232(l)<2>;``````
2 Likes

It worked
But can you please explain to me what this line means?

cs=(cv==1.32)<1>?class132(l)<2>:class232(l)<2>

Other than this line everything else in the code block defines the functions class132 and class232
In this line, one of the above defined functions is called depending on the class value input

If the class value fed in was a number, replication guides wouldn’t be required. The replication guides (<1> and <2>) are required to process the list of class values.

Hope I’ve managed to explain the statement.

1 Like

And how would that last line be if i had more class values?
In fact i have 24 Class Values…
CV = 1.12
CV = 1.13
CV = 1.22
CV = 1.23
CV = 1.32
CV = 1.33
CV = 1.42
CV = 1.43
CV = 1.52
CV = 1.53
CV = 1.62
CV = 1.63
CV = 2.12
CV = 2.13
CV = 2.22
CV = 2.23
CV = 2.32
CV = 2.33
CV = 2.42
CV = 2.43
CV = 2.52
CV = 2.53
CV = 2.62
CV = 2.63

How would i set up that last line?
Thank you!

I created a really long list containing all values for cross sections for every class value

but without that last line it won’t work

Thank you

@ramoon.bandeira A similar conditional statement would be quite confusing in this case
Try a different approach. Something like this …
cscv.dyn (4.2 KB)

2 Likes