Greetings,

Is there a way to tell Forena to link a column conditionally, depending on some other data in the report? In my report some rows have detail data and other don't. I'd like the users to be able to click the ones that do and link them to a new report with the data.

Thanks!

Comments

metzlerd’s picture

Yes, there is.

You can add an frx:if= attribute to any tag with an expression that references a column. For example:

<span frx:if="{nid}">Content that happens when there is an nid</spen> 
<span frx:if="!{nid}>Content that happens when there is no nid</span> 

Hope that helps.

msquires’s picture

Thanks for the quick response. I'm trying to evaluate this:

         <td><span frx:if="{is_test}=Y" id="forena-6"><b>test-{area}</b></span>
          <span frx:if="{is_test}=N" id="forena-7"><b>folder-{area}</b></span></td>

and its returning both. I must be messing something up?

msquires’s picture

I got it I think, thanks. I guess you can only do null vs. not null?

This worked for me:

<td>
<a href="http:...." frx:if="{is_test}" id="forena-6"><b>{area}</b></a>
<span                 frx:if="!{is_test}" id="forena-7"><b>{area}</b></span>
</td>

Thanks!

metzlerd’s picture

Yes, it only tests null or non null BUT it tests it with xpath expressions. So technically you can get quite a bit of value based checking. Consider the following example:

<div frx:if="{type[text()='article']}>
  conditional article text goes here. 
</div>

The above snippet would only present if the type field in the sql query were "article".

Glad you got this working.

Dave

msquires’s picture

Thanks for your help Dave!

I should also mention a small thing that threw me for a loop for a couple of minutes, the URL I was linking to had a parameter in it so I had to replace the "&" with &amp; before it would save correctly, I really was kicking myself after I figured that one out :)

metzlerd’s picture

Status: Active » Closed (fixed)

Seems answered so closing.