I need summary information in the report header - parameters would actually be good to use, but I can't see how nor find any documentation on this.
This would be useful to have to display instead of in the Parameter form, and also print in pdf.

As it stands, I'e had to create another report to get the summary info I want in a separate block, styled to look like header information.
e.g Product, Time period etc

Any thoughts? Can parameters be used as report tokens?

Thanks.

Comments

Pierre.Vriens’s picture

Mick, to answer your question about " Can parameters be used as report tokens?": it appears to me that the answer to that question is YES. A sample of it can be found in reports/sample.user_distribution_simple . If you execute that report with a parm like (eg) state=VA, or you just use an URL like /reports/sample.user_distribution_simple?state=VA, the report will contain a phrase like "This report lists all users in cities assigned to a state with code = VA.". Line 26 in the .frx source of this sample that creates that phrase looks like This report lists all users in cities assigned to a state with code = {parm.state}..

So if I correctly understood that question, the answer is {parm.YourRptParm}, whereas YourRptParm corresponds to the "id" for the report parameter, as specified with the frx:parm tag.

FYI: this sample report is where I first discovered this little trick while I was working on the documentation. Variations of this can be found in the recently added reports/help/toc.frx and in reports/sample/toc.frx, where in both cases there are a lot of frx:if constructs using {parm.show_chapters} and {parm.show_abstract}.

Does this answer your question? If not can you add some more details, e.g. with the relevant part of your .frx file, together with an eventual error msg you get, or some type of info/data that does not get rendered correctly?

About your "... nor can I find any documentation on it": not sure if my reply above is an answer to your question, but your question made me realize that what I wrote above should be considered for inclusion in (at least) reports/help.reportingfrx#datacontexts . Though I can't think of any corresponding spot in the reports/help.reportingwysiwyg . Let's wait for David's feedback on this. If he agrees that I add it, I'm assuming it will show up in 7.x-4.1 some day.

PS: are you still using the (outdated) 7.x-4.0-beta4 version? You're aware that 7.x-4.0 is release now, right?

Pierre.Vriens’s picture

Another example illustrating what I wrote above can be found in the report screenshot attached in issue #2337327, which includes "Watchdog statistics about 8 most recent log messages ...", whereas that "8" corresponds to {parm.limit}in its .frx file.

Note: After David reviewed my watchdog sample there, and a few related samples, he informed me about some issues in them that needed more work (even though he seemed to like them a lot). So we decided to not yet include them in the 7.x-4.0 version. I seem to remember that the issues were about the performance of the data blocks (SQLs) if they'd be used in a Drupal site with huge watchdog volumes. And also that the FrxCrossTab renderer that was used in it had evolved in the meantime (in the then current dev version as compared to some beta version I had been using then), e.g. the SVG Graph related stuff that's now in David's new FrxCrossTab video.

I'm assuming / hoping that an enhanced version of them will start to show up in a future 7.x-4.x version, after David has had the time to further correct / enhance them. Provided David would agree to it, I think it would be a good idea to share those not-yet-approved-by-David watchdog sample reports. I.e. as attachments in a new issue like "Watchdog samples", with status 'needs review' (or is it 'needs work'?). That would allow us to start gathering feedback / similar contributions / use cases from other forena-fans also, and try to include that feedback also in some official version of it later on.

MickC’s picture

Thanks Pierre - very helpful. I am now able to use parameters as tokens in the report.

I also found in help/toc.frx example some very useful "frx:if=..." code, with which to control styling if the parameter is selected, e.g. to add a "|" separator:

{parm.MyParameter1} <span frx:if="{parm.MyParameter2}">|{parm.MyParameter2}<span>

My 3rd parameter is a multi select ie an array - I can't see an example of how to add a separator for each array item, but I can live with that for now.

Hope this help someone else, cheers.

Pierre.Vriens’s picture

Mick, happy to see that helped. Does that mean your original question is resolved? Also, help.toc has received similar compliments from others, which also explains why it got cloned in samples.toc (similar, but different topic).

To answer your new question: it appears tp me that there is some typo or syntax error in the code you pasted. Can you EDIT your comment to correct it? FYI: looks like your array question is similar to something in the frx:if construct that I have not been able to figure out, so hopefully David can add some sample about that here (so that I can also include it in the tutorials related to the frx:if ... ).

metzlerd’s picture

Fyi: I don't see the typo you are talking about. It looks valid to me.

Pierre.Vriens’s picture

Status: Active » Postponed (maintainer needs more info)

Here is why I think there is 1 or more "typo or syntax error in the code you pasted" (as I wrote in #4):

  1. I see a MyParameter1 and MyParameter2 (twice), but I don't see something like a MyParameter3.
  2. Because of the <span frx:if="{parm.MyParameter2}"> and <span>, it appears to me that there should be a </span> (twice), or otherwise the second <span> should be </span>.
  3. The | at the end of <span frx:if="{parm.MyParameter2}">| seems strange to me. Maybe it's some syntax in forena that I'm not aware of, or maybe something is missing before/after it, or maybe it just shouldn't be there.

To continue my guessing, maybe the pasted code was assumed to be something like this:
{parm.MyParameter1} <span frx:if="{parm.MyParameter2}">{parm.MyParameter3}</span>

I'd write the above code in a forena report to show the value of MyParameter1, followed by the value of MyParameter3 but only in case the value of MyParameter2 is 'true' of '1'. Am I correct in translating the above code to something human readable?

1 more guess: maybe the pasted code was assumed to be something like this
{parm.MyParameter1} <span frx:if="{parm.MyParameter2}|{parm.MyParameter3}">abc</span>

I'd write the above code in a forena report to show the value of MyParameter1, followed by the string abc but only in case the value of EITHER MyParameter2 or MyParameter3 is 'true' of '1'. Am I correct in translating the above code to something human readable?

Not sure if either of my guesses come close to what Mick is trying to achieve in the report though ... Therefor I think it's best to wait for Nick to get back with some clarifications on this, which is why I suggest to update the issue status as I now did (feel free to correct the status of course if this new status is not correct).

MickC’s picture

Hi Pierre:
1. I left MyParameter3 out of my previous post
2. Yes it is actually </span>
3. The pipe symbol "|" is just a separator to be printed along with MyParameter3 if exists

Actually the whole thing is this
{parm.MyParameter1} <span frx:if="{parm.MyParameter2}">| {parm.MyParameter2}</span>| {parm.MyParameter3}

So 1 and 3 are always displayed as they are required parameters, 2 only if selected.
The pipe symbol is the separator for all.
Parameter 3 is a multi select, no separator between values as yet.

I'm happy for now - unless there's a way to insert a comma separator for parameter3.

Thanks.

MickC’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)