Hi,
I have followed the various posts about using the Computed Field for formatting text and for calculating values. I may be missing something - is there a way to do both of these at the same time ?
I want the Totals field in a matrix which calculate by adding up various other fields to show as bold. I've tried some different variations, but the best I get (aside from 'The formula is invalid ' messages), is the text I used for the calculation with the Field IDs showing up on the record which isn't quite what I want - see attachment.
I feel it's probably something simple, but my knowledge isn't quite there to work it out.
Thanks,
Fiona
Solved! Go to Solution.
Hi Fiona,
When using the computed field, you need to make sure to drop the “item.”
Example,
When using Java you would use:
item.A+item.B
When using computed fields (SQL based):
A+B
There is a webinar available that discusses this:
Computed Fields March 6, 2013
Also in the Wiki at:
If you are looking to do the Math then Format it (highlight, change color …)
This will need to be done in two steps, as you are mixing SQL with HTML.
Thanks Joe for the reply.
Yes, it is your last point about mixing the SQL with the HTML that is the key. When you say do it in 2 steps, what do you mean? I'm not sure how to do this.
[The back story of what I am trying to do is here, though this is perhaps of less use now you have explained I can't mix the 2 at the same time:
This is what I tried:
1. Original calculated formula using Field IDs:
CAD_SOLD_HRS + M_SOLD_HRS + V_SOLD_HRS + F_SOLD_HRS + D_SOLD_HRS
This worked fine, giving me a Float value as expected.
2. Then I wanted this value to show as Bold so I tried:
' <span style="color:black; font-weight:bold;">CAD_SOLD_HRS + M_SOLD_HRS + V_SOLD_HRS + F_SOLD_HRS + D_SOLD_HRS</span>'
This resulted in it putting the formula into the field and making that bold, but not showing the value.
3. I tried it with parentheses ( ) but got the same result (ie. the formula inside the parentheses all showing bold. (see attachment)
4. I tried mixing the 2 up instead:
CAD_SOLD_HRS + M_SOLD_HRS + V_SOLD_HRS + F_SOLD_HRS + D_SOLD_HRS' <span style="color:black; font-weight:bold;"></span>' and the other way round (the formatting info followed by the computation)
but as I thought, neither of those worked either - I just got that the formula is invalid.
So....how do I get the resulting VALUE for the calculated formula to show up as bold...? ]
Fiona,
Actually, I am mistaken, based on HTML coding anything between the “><” would be considered string text and not available as object based reference.
So back to the original question No you cannot mix SQL Math with HTML formatting. Nor could one do this as a two-step process based on the nature of HTML Tagging.
Thanks for the reply Joe.
At least I'm now clear that it can't be done, so I don't need to spend any more time trying to figuring it out!
Unles anyone does know of a clever workaround - but I'll assume that for now, there isn't anything.
Best regards,
Fiona
Can't find what you're looking for? Ask the community or share your knowledge.