Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Return two queries with <cfreturn>

Participant ,
Jun 03, 2008 Jun 03, 2008
Hello All,

I know I've seen it done somewhere, but I can't seem to find the example. I need to return two queries like:

<cfreturn getCurrentProjects and getProjectRequestByStatus/>

Something like that... not getting the right syntax or something. Any clues?

Thanks!
381
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2008 Jun 03, 2008

You can't!!!! You can only return one value with <cfreturn...>

.
..
...

But of course there is nothing preventing that one value to be a
structure or array contain two query record sets.

I.E.

<cfset var myReturn = strunctNew()>
...
<cfset myReturn.getCurrentProjects = getCurrentProjects>
<!--- getCurrentProjects is scoped as a local variable with VAR,
correct? --->
<cfset myReturn.getProjectRequestByStatus = getProjectRequestByStatus>
<!--- getProjectRequest is scoped as a local variable with Var, correct?--->

<cfreturn myReturn>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 03, 2008 Jun 03, 2008
Thank you for your quick response! Just need to figure out how to display it out in my Flex App now.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2008 Jun 03, 2008
While Ian's answer is correct, my approach would be to run two functions and return one query per. It would be simpler to develop and maintain.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 03, 2008 Jun 03, 2008
Thanks Dan.... I would do that, but I've got a Flex Datagrid that needs information from both queries... I'm not sure if I can have two dataProviders for a Grid... I should check that out! Thanks again!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2008 Jun 03, 2008
LATEST
That changes everything. Ian's answer won't solve your problem either. You are going to have to figure out how to put everything into one query. Looking at the query names in your OP, it seems that it should be quite simple, but they could be misleading.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources