Question

Photo of Michael Garrison

0

Using Key-Value pair attribute

OK, we want to track people to whom we dispense benevolence - to make sure that we can identify if/when it's been dispensed to that person before.

It seems that the best attribute type for this is a key-value pair, since we will be linking an arbitrary number of dates with an amount. So far, so good.

But when I add that attribute to the person profiles, it simply says "x Key Value Pair(s)". If I edit the attribute, it shows the date and amount, but I'd like that to show up more usefully on profiles without the extra click. However, I don't see that attribute available through Lava (it just reads the same "X Key Value Pair(s)"), so am I going to be doing this with a Dynamic Data block or is there a more straightforward way?

Thanks

  • Photo of Rock RMS

    0

    The 'X Key Value Pair(s)' is the formatted output of that attribute's field type.  You can access the raw value in Lava by adding a 'RawValue' qualifier to the atttribute filter.  

    For example...

    {{ Context.Person | Attribute:'BenevelenceAmounts','RawValue' }}
    
    • Michael Garrison

      Great, thank you. Any chance we could get the pre- and post-HTML fields to be lava-capable on the key-value block (and probably other block types with those options) so I don't have to separate my custom display of the data from the edit button for that same data?

    • Michael Garrison

      I figured out a workaround for the post-HTML field not being Lava-capable: I created an HTML block ABOVE my key-value block and used that output (which IS Lava-capable) to store my string in a javascript variable. That block functionally disappears because it doesn't write anything to the page.
      Then in the post-HTML field of the key-value block I create a DIV containing the javascript document.write function to display the string. But that still appears below (visually disconnected) from the key-value block div.panel-body. No problem; give the div I create in the post-html field a unique ID (here BenevolenceSrc) and use JQuery to move it: $('#BenevolenceSrc').parent().find("div.panel-body").append( $('#BenevolenceSrc') );