We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44580
    • 189 Posts
    This should be simple, but I'm having a brain explosion...

    I have a Mixdb CMP. One of the fields has a value of 1 or 0. 1=Primary and 0=Secondary. In my Formtab definition, it is easy to replace the 1 and 0 with something descriptive by using Input Option Values of:
    Primary==1||Secondary==0
    How do I do the equivalent for the Column display?

    (I've previously done this by joining to a descriptor table and substituting values, but with only two possible values this would be overkill)

    This question has been answered by ottogal. See the first response.

      • 44580
      • 189 Posts
      I've got another instance of this now where I'm using a listbox to do in-line editing. It is simple to set up the listbox with the descriptors (in this case "Paid" or "Unpaid"), but when I make a selection I get a 0 or 1 in the column. How do I set up the column (as above) to display the text (while saving the value to the database)?
      • discuss.answer
        • 22427
        • 793 Posts
        You could try to use the Renderer this.renderChunk and a renderChunk template similar to this:
        [[+yourlistbox:is=`1`:then=`Paid`:else=`Unpaid`]]
        (Not tested.)
          • 44580
          • 189 Posts
          Thanks Helmut. That worked. I think if I end up with many more of these key=value pairs then I'll put them in a table so that they can be more easily maintained - but this will do fine for now.