Get ready for BLACK FRIDAY shopping starting in

HTML5 Data Bindings Formatter Support Product Page

Answered

Using Data Bindings Formatter in place of PHP Switch (Select Case Statement)

Asked 13 Jan 2018 20:43:02
1
has this question
13 Jan 2018 20:43:02 Armen M posted:
I am displaying fields from a single record using the DMXzone Server Connect and the HTML 5 Data Bindings extensions. I also have the HTML 5 Data Binding Formatter extension installed. A few of my fields have integers saved which corresponded to items in the form (drop-down) that the user selected when submitting a form. How do I now display those on the page? For example, one filed can have a value of 1, 2, or 3. I want to display Email if the value is 1, Phone if the value is 2, and Fax if the value is 3. How can I do this using DMXzone extensions? In the past I simply used a PHP Case statement to accomplish this. This is what the current field display looks like: {{appDetailsExec.data.query1[0]["1_07-PimaryContactType"]}}

I have been playing with the HTML 5 Data Bindings Formatter, but the documentation is a little light and I can't seem to get it to do what I need. Any help is greatly appreciated.

Replies

Replied 15 Jan 2018 12:58:16
15 Jan 2018 12:58:16 Teodor Kuduschiev replied:
Hi Armen,
Using the then filter, you can achieve this:


In your case that would be:

Quote{{(appDetailsExec.data.query1[0]["1_07-PimaryContactType"] == 1).then( "Email", "" )}} {{(appDetailsExec.data.query1[0]["1_07-PimaryContactType"] == 2).then( "Phone", "" )}} {{(appDetailsExec.data.query1[0]["1_07-PimaryContactType"] == 3).then( "Fax", "" )}}

Replied 15 Jan 2018 22:26:56
15 Jan 2018 22:26:56 Armen M replied:
Thank you!

Reply to this topic