view, fn or var?

emmexx 12 Dec, 2017
I'm a little bit confused about the use of the different shortcodes. Sometimes I can't find consistency in the results or I can't find a rule as to how to use one or the other.

Example given.

I created a view event to display the content of a db record. The event content is:
{fn:read_event}
{view:event_data}


The view is an HTML object whose content is:
<dl class="uk-description-list uk-description-list-line">
  <dt>1st field</dt>
  <dd>{var:read_event.event.1stfield}</dd>
...


One of the fields has json content (the result of a repeater/multiplier in the form):
[['name' => 'maxx', 'description' => 'some text'], ['name' => 'Jim', 'description' => 'some other text']]

In order to display the content of that field in the view I created a function that i call like this:
  <dt>Names</dt>
  <dd>{fn:join_array$myarray=(var:read_event.event.names)}</dd>


The join_array fn is a Loop that has {var:myarray} as Data provider and {var.join[ -> ]:join_array.row} as Loop body.

Everything works fine here.

I decided to reuse the join_array fn in another context.

In a table view I added a column that displays a tooltip icon. The tooltip content is retrieved from the record data of the row.
So in the Column views of the table view I added:
popup:{fn:popup_event} (and I tried with a view too popup:{view:popup_event2} )

The popup_event fn is a Custom field in which Content is:
<i data-hint="{var:table2.row.event.1stfield}, {var:table2.row.event.2ndfield}
<br />
{fn:join_array$myarray=(var:table2.row.event.names)}" class="icon info circular blue inverted small tooltipstered"></i>


In the tooltip 1stfield and 2ndfiled are displayed but nothing else. Why?

Thank you
maxx
emmexx 13 Dec, 2017
Answer
1 Likes
I found out the problem. 😟
The field event.names is json formatted. When you retrieve it using a read data you have to put it in the Special fields list in the format
field/json.
In my 1st example event.names was in the special fields list, in the 2nd it wasn't. My bad.

Problem solved.

maxx
This topic is locked and no more replies can be posted.