Attributes from a list and IF

Hey there! its me again, honestly i dont know what i would do without this forum haha

I am not good with the IF functions, if its this function the one that i should use, i proceed to explain:

I have a list of materials like this to select the color of the Component:

Senza titolo

Now, i want to have another attribute, hidden because it is only useful for my report, that should do this:
If the material selected is Bianco W, then it should show a W, and so

I tried to write =if(material,bianco W)=w but it wont work :confused:

=if(argument, result is true, result if false)

=if(material=“Bianco W”, “W”, material)

to include all

=choose(optionindex(“attribute name”), “W”,“G”,“MS”,“Y”,“K”,“S”,“N”,“O”,“YE”,“I”,“B”)

so it choose the letters based on the list index, with correct attribute name

1 Like

Weird things are happening :laughing:

1

Correction, sorry did not test

Need the quotes for string otherwise the formula is looking for an attribute

with if, String compare in argument should be same, if (material=“Bianco W”…

corrected above I think, of course much easier to have files, can you consider sending to email?

another way is to find the space, then return what is after

pos=find(" ",result,1)
new_result = mid(result,pos+1,len(result)-pos)

that works if there is a space

for “Bianco W”
pos = 7
mid = start at 8, length = length of string (8) -7 =1
so returns a string at position 8 with a length of 1

1 Like

I am going to try and otherwise i send you it but it will be late this day because i have to go back home, thanks!

another amendment,
attribute name is not material, but the dropdowns attribute

maybe
result = choose(optionindex(“distinta_colore”), “W”,“G”,“MS”,“Y”,“K”,“S”,“N”,“O”,“YE”,“I”,“B”)

one thing to consider as well - consistent length and position of the values you are looking up - essential “embedded data”. for example, i often need to lookup some set up values based on a selection, i need “prime” + “number list” that i will subsequently split up, so in the list, i have two digits for prime (5-43), and a two digit per number string of numbers. so i know looking up i need two digits for the prime set, and then each pair of digits in the string is read out nicely over the copy looping.

so consider the lookup and values delivered so you can reliably find the exact match and not just the first one.

my head aches haha i dont know why i struggle to understand this attribute in particular, im goint to try everything and let you know! thanks

I now understand you cannot directly use the material as a dropdown as references do not update without a redraw.
So the material needs to reference a sperate attribute dropdown, then update works

material workings.skp (18.7 KB)

can you make a simple model as sent to with your materials and basic dropdown, then can build solution(s)

Here it is!

Tube.skp (16.0 KB)

The thing is, a have to be able to choose the material, as you can see from a list, and i need it to be seen like this, with the name and the letter “Bianco W”(white W), this because this component has to be used by other colleagues.
But in order to generate re report, i was requested that it has to be shown only the letter, thats why my intention is:

If in material is selected Bianco W, in the attribute “distinta_colore”(report_colour) it should be shown W, and so with the other materials/colours from the list.

Got the third method to work, will look into why second does not.

symbol via find.skp (27.0 KB)

1 Like

Got this to work, by typing in the value rather than copy and paste, seems that the formula kept tying to find an attribute even though quoted. very buggy, so third method best.

Though just thought of a fourth , distinta_color could be the dropdown with symbols as the values and material reads the optionlabel. (full name)

4th might be the way to go, simple and easier to understand
2nd tube
symbol via find.skp (42.1 KB)

1 Like

You have been great PcMoor as always! Thank you so much, i will let you know my advancements on this issue!

Given that all the entries have 1 word followed by a space you could use
Materialname = xxxxx
Space = Find(materialname," ")
Length = Len(materialname)

and finally
Value = Right(materialname, Length - Space)

Im not at my computer to check if this format is correct but this is the approach i would take
Essentially it finds the space and returns the characters after that

1 Like

Magnificent, i find this method the best and fastest to replicate, as i have to modify this tube in all the DCs i have already made and i donw want to configurate again from scratch haha (any suggestions accepted)

In addition, i had to add another attribute, as directly from “distinta colore” (selected from a list) for some reaseon i didnt get the value when a generated the report, i made the color selection and THEN another “distinta_colore” that refers to color, so far it works, i will update you all if something changes.

Tube.skp (18.5 KB)

You all have been great! Than you ! Happy holidays for everyone :christmas_tree: