Quantcast
Channel: Adobe Community : Popular Discussions - Reporting
Viewing all articles
Browse latest Browse all 38309

Creating a function and passing query value

$
0
0
I have what I thought was a pretty easy to resolve situation: I want to concatenate two query fields, if the 2nd one isn't empty.

I created a function:

<cfargument name="q1" value='#query.q1#' />
<cfargument name="q1a" value='#query.q1a#' />

<CFSET variables.myPunct = ": ">
<cfset variables.ResultVar="">

<cfif Trim(arguments.q1) NEQ "">
<cfset variables.ResultVar='#arguments.q1#'>
</cfif>

<cfif Trim(arguments.q1a) NEQ "">
<cfif variables.ResultVar NEQ "">
<cfset variables.ResultVar='#variables.ResultVar & variables.myPunct#'>
</cfif>
<cfset variables.ResultVar='#variables.ResultVar & arguments.q1a#'>
</cfif>
<cfreturn variables.ResultVar>

This is basically just the example they provide in the online instruction, with the names changed.

In the detail band of my report, I have an expression builder field containing: report.mytestfunction()

When I run this, I get: Element Q1 is undefined in ARGUMENTS.

I've tried this ninety different ways (literally). It seems very clear to me that the query.q1 (for that matter, any of the query results) are NOT getting passed to the function. I have tried making the expression: report.mytestfunction(query.q1). I have tried creating an input parameter.

The documentation on this is ridiculously limited, considering that the ability to implement conditional logic depends entirely on the "function", as far as I can tell. I can in no way get the function to interface with the query results. If is set fixed values in the function, as opposed to trying to use the query variables, it outputs fine.

Any ideas?

Viewing all articles
Browse latest Browse all 38309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>