The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hello,
I have a problem, I have a parameter defined as a string and that should appear as, in this specific model, "4,0", but which indeed appears as "4," --> without the zero.
(It cuts-off the last figure).
The strange thing is that if I add a test parameter defined in the same way (in the same) it comes out correctly as "4,0". I post below a screen recording of what I mean:
(hoping that is clear).
Anyone knows what is it due to and how to fix it?
Thanks
bye bye
Hi Tommaso,
I haven't seen this problem before, but I would suggest using the "=?" toolbutton in the Relations window to investigate.
This pops up a small dialogue box which allows you to evaluate any formula, and immediately see the answer - so for example, you can check the value of pro_mp_mass and also the result of pro_mp_mass - floor(pro_mp_mass), just by copying and pasting from the Relations editor.
Try evaluating small parts of your relations in this way, and make sure that each small part gives the answer you were expecting.
Good luck!
Hi Johnatan,
yes, it definitely was a mistake in the logic that, with this particular number, gave back an error in a string line.
Indeed massa_disegno appears "correctly" as "4,".
thanks
bye bye
Are you positive this is a string-valued parameter? Removing trailing zeroes (generally via detail setup options lead_trail_zeroes and lead_trail_zeroes_scope, generally driven by your standards) would make considerably more sense if it were a real number -valued parameter.
Hi Matthew,
yes I had to make it a string parameter just for reasons linked to the approximations and, above all, to the fact that that parameter massa_disegno is a value I had built to "please" the eye in the drawing tables, that is an indication of mass rounded accordingly to the value of the mass, e.g. 5,2 kg, 204 kg, 768 g...depends on the order of size of the mass).
bye bye
Check your If/Else logic, I think the mp_pro_mass is falling through and using the default statement at the end, rather than the one you are using for the test.
Like Jonathan said, use the relation tools '=?' to evaluate the relations and see where they go.
Exactly. The statement you copied from is only for values less than 0.05. 4.0 is going to be handled by the last 'else' statement.
Hi Ben,
yes, the problem in fact was exactly on the logic, it grabs the second last line.
bye bye
Tomasso,
I suggest you to change the structure of IF commands in relations to the following one.
if pro_mp_mass < 0.0005
/* mass < 0.0005
else
/* mass >= 0.0005
if pro_mp_mass < 0.05
/* mass >= 0.0005 AND mass < 0.05
else
/* mass >= 0.05
if pro_mp_mass < 0.95
/* mass >= 0.05 AND mass < 0.95
else
/* mass >= 0.95
if pro_mp_mass < 1
/* mass >= 0.95 AND mass < 1
else
/* mass >= 1
endif
endif
endif
endif
Martin Hanak
Hi Martin,
yes, it was missing the interval " 0,95 > >=0,05 " (which I wrongly thought came in the "else" case) and I modified it by adding an if with it:
if pro_mp_mass<1 & pro_mp_mass >= 0.0005
massa_disegno=itos(1000*pro_mp_mass) + " g"
else
if pro_mp_mass-floor(pro_mp_mass) < 0.05
massa_disegno=itos(floor(pro_mp_mass)) + ",0" + " kg"
endif
if pro_mp_mass-floor(pro_mp_mass) >= 0.95
massa_disegno=itos(ceil(pro_mp_mass)) + ",0" + " kg"
endif
if pro_mp_mass-floor(pro_mp_mass) < 0.95 & pro_mp_mass-floor(pro_mp_mass) >= 0.05
massa_disegno=itos(floor(pro_mp_mass)) + ","+ itos(10*(pro_mp_mass-floor(pro_mp_mass))) + " kg"
endif
if pro_mp_mass < 0.0005
massa_disegno="< 1 g"
endif
endif
and now comes out correctly...(didn't realize it conviced that was ok...better later than ever ).
bye bye