Hi, I'm trying to have a report according to my needs.
I've an attribute named dc: um that's coming from the seed component. Is a choosing dropdown list: mq, mc, kg, etc..
particularly:
the field cost_tot should be conditioned in this way:
IF dc: um is equal to mq (according with is it choose in the dc list)
THEN cost_tot is = %a-m% * cost_unit (first operator could change for ex in %v-m% if is listed mc .. and so on)
I'm novice both SD both Ruby.
Could yopu help me?
Many thanx
Pier
I link file for analysys.
Replies
I cannot test now, 'cause I'm going to sleep (italian time)
Tomorrow morning I will upload something on which I'm working on...
Hedache!
Ciao
Pier
Hi Pier,
I can see that you have tested the option already.
I typed my post yesterday and I paste it Today :) amended online but it took me more than 10 minutes and my time for changes was up !
Regards
Gregory
Hi Pier,
Have a look the Ruby operators.
http://www.tutorialspoint.com/ruby/ruby_operators.htm
Based on Al's example and changing the DC 'Value' to 'NUMBERS' (your component uses 'TEXT' in 'Value') where:
- 'm2' is '1'
- 'm3' is '2'
the Ruby works - PAO.pdf report attached
%dc: um% == 2 ? %cost_unit% * %area% : %cost_unit% * %volume%
Probably you have tested the option described above.
The downside is - you cannot get the 'UM' as 'm3', 'm2' on the SD report (or I don't know how to do it)
Regards
Gregory
PAO.pdf
Yes, you are in the right. I think that the problem belongs by text argument (m2, m3, ...) in numeric field. This could be confirmed by the fact that if you substitute m2 with 1, 2, etc. the Ruby seems to do his job.
Only Al, I think, could dig inside the question.
I'll wait.
All the best
Pier
Hi Pier,
I don't know Ruby but looking at some examples online like:
and substituting the case expression (x=1) and conditions (if ... , elsif ... , else ...) to
%DC: um%=m2
if %DC: um%=m3 puts %cost_unit% * %volume%
elsif %DC: um%=m puts %cost_unit% * %DC: lenx%
else put "way of measurement is not defined" end
I wonder if the case expression (%DC: um%=m2) should be numeric (number) rather than letter + number (m2) ?
I think Ruby has some problem with the m2.
Otherwise we have to dig somewhere else.
Al,
Is my thinking correct or am I completely wrong.
Regards
Gregory
Al Hart said:
Dear Al,
I have the latest version of SD (LD30sd) and all the dynamic components attributes (DC: ...) cannot be input in CAPITAL letters. Only one of them can be in capital DC: the rest is automatically changed to lower case dc:. At the same time it would allow you to EDIT the lower case attribute to be capital but subsequently removes/changes the previously set to lower case.
Regards
Gregory
Pier
We posted a new version of SpaceDesign (see Downloads above) which will read dynamic component values from groups.
You will still have to enter the "dc: um" attribute name by hand. We read through all component definitions to find dynamic component names, but I did not want to have to read through all groups.
Give it a try and let me know if it works for you.
Dear Pier and Al,
I'm watching your discussion about DC and the Tak2Ata plugin. I can only assume that Pier is talking about BST Building Structure Tools0.5.4 update Dec18, 2011 http://forums.sketchucation.com/viewtopic.php?t=35798.
I'm testing the plugin and I'm thinking how much info I could extract from the DC elements using SD.
Regards
Gregory