HTML5 Data Bindings Formatter Support Product Page
Answered
Returning a value based on a condition
Asked 24 Mar 2014 21:35:46
1
has this question
24 Mar 2014 21:35:46 Danny Dominguez posted:
I have the following MYSQL query IF(amount2 IS NOT NULL, FORMAT(amount2,2), '...')AS 'amount2'I was trying to use the Conditional WHEN where I set the formatted field amount2 >0 and for the If valid field {{amount2}} and for the Otherwise field --
But it does not work. Is there another way to do it without using DW recordset?
Replies
Replied 25 Mar 2014 09:42:54
25 Mar 2014 09:42:54 Teodor Kuduschiev replied:
Hello Danny,
What exactly do you need to achieve?
If the {{amount2}} value is > 0 then you need to display it? and if it is not, then you don't want to show it?
What exactly do you need to achieve?
If the {{amount2}} value is > 0 then you need to display it? and if it is not, then you don't want to show it?
Replied 25 Mar 2014 14:15:04
25 Mar 2014 14:15:04 Danny Dominguez replied:
I have two columns, amount and amount 2. Amount column is used to give customers a quote amount. If the service is sold at the original quote, then amount2 displays "-". But if the price changes, then column2 displays the new sold price.
IF(amount2 IS NOT NULL, FORMAT(amount2,2), '...')AS 'Sold for'
IF(amount2 IS NOT NULL, FORMAT(amount2,2), '...')AS 'Sold for'
Replied 26 Mar 2014 08:24:26
26 Mar 2014 08:24:26 Teodor Kuduschiev replied:
Hello Danny,
Here is what you can do - add 3 spans on you page:
In your data bindings tree click the @amount2 data element, select the <span>{{amount}}</span> select Bind To: span.data.hide
Do the same with the <span>-</span>.
This way - when the amount2 is null, the amount and - will be displayed, and when the amount2 is not null and has a value the other two will be hidden.
Here is what you can do - add 3 spans on you page:
<span>{{amount}}</span> <span>{{amount2}}</span> <span>-</span>
In your data bindings tree click the @amount2 data element, select the <span>{{amount}}</span> select Bind To: span.data.hide
Do the same with the <span>-</span>.
This way - when the amount2 is null, the amount and - will be displayed, and when the amount2 is not null and has a value the other two will be hidden.