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

Recreating Msoft Merge reports using Evaluate function

New Here ,
Nov 19, 2008 Nov 19, 2008
I am trying to duplicate the functionality of Microsoft Merge reports so that users can create a template which would later display with information dynamically inserted from a "User" table.

I know (or think) that this should somehow involve the Evaluate function to dynamically interpret the varibles involved but it isnt working. Can someone point me in the right direction?

I have a query called "Users" that has the columns "FirstName" and "LastName". This is my reasoning code wise...

-----------------------------------

<cfset theMessage = "Hello #Users.FirstName# #Users.LastName#, Welcome to the group">

<cfloop query="Users">
#Evaluate("theMessage")#
</cfloop>

This is what I intended to output

- Hello John Doe, Welcome to the group
- Hello Bob Smith, Welcome to the group
- Hello Jane Smith, Welcome to the group

but this is what actually gets output

- Hello #Users.FirstName# #Users.LastName#, Welcome to the group
- Hello #Users.FirstName# #Users.LastName#, Welcome to the group
- Hello #Users.FirstName# #Users.LastName#, Welcome to the group


anyone have any ideas? thanks.
TOPICS
Advanced techniques
259
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 ,
Nov 20, 2008 Nov 20, 2008
eoapps wrote:
> I am trying to duplicate the functionality of Microsoft Merge reports so that
> users can create a template which would later display with information
> dynamically inserted from a "User" table.
>
> I know (or think) that this should somehow involve the Evaluate function to
> dynamically interpret the varibles involved but it isnt working. Can someone
> point me in the right direction?
>
> I have a query called "Users" that has the columns "FirstName" and "LastName".
> This is my reasoning code wise...
>
> -----------------------------------
>
> <cfset theMessage = "Hello #Users.FirstName# #Users.LastName#, Welcome to the
> group">
>
> <cfloop query="Users">
> #Evaluate("theMessage")#
> </cfloop>

<cfloop query="Users">
Hello #Users.FirstName[CurrentRow]# #Users.LastName[CurrentRow]#,
Welcome to the group
</cfloop>

--
Mack
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 ,
Nov 20, 2008 Nov 20, 2008
alternatively
<cfoutput query="Users">
Hello #FirstName# #LastName#, Welcome to the group
</cfoutput>

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
New Here ,
Nov 20, 2008 Nov 20, 2008
LATEST
thanks for the responses but i dont think i explained myself correctly.

i simplified the code but in the example the value of the variable "theMessage" actually is stored in the database so I do not know what the message could be before outputting it. the value could be "Hello #Users.FirstName#" or "Do you like ice cream #Users.FirstName# ?"

Therefore I cant do a simple

<cfoutput query="Users">Hello and Welcome #FirstName#</cfoutput>

because again I dont know that the "Hello and Welcome" text actually belongs there. Id have to query the database to find the exact message used. So my example would actually be something like this..

-----------------------------------------------

(GetMessage.Content is a column in the db which equals "Hello #Users.FirstName# #Users.LastName#, Welcome to the group")

<cfset theMessage = "#GetMessage.Content#">

<cfloop query="Users">
#Evaluate("theMessage")#
</cfloop>


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