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

Passing datagrid results to CFM coldfusion

New Here ,
Oct 03, 2010 Oct 03, 2010

In my flex code I have a datagrid showing all the records related to a single Employee_ID. What I need is to send an email with all the Job_unctions of a partiicular employee???

For Example:

Employee_ID      Employee_Name      Job_Functions

1                       Joe                           Sales Representitive

1                       Joe                           Assistant

1                       Joe                           Personal Secetary

SQL Query:

Select Distinct Employee_ID, Employee_Name, Job_Functions

          From EmployeeDB

Flex Code:

private

function EmployeeResult(event:ResultEvent):void{

EmpRes = event.result

as ArrayCollection;

}

<mx:DataGrid

id="EmpJob" dataProvider="{EmpRes}" rowCount="{EmpRes.length}">

<mx:columns>

<mx:DataGridColumn headerText="Job Functions" dataField="Job_Functions"/>

</mx:columns>

</mx:DataGrid>

Now this datagrid displays the data as following:

Job Functions:

Sales Representitive

Assistant

Personal Secetary

I need to send an email with all this info:

Flex Code:

var Employee_ID

:String = Employee_ID.toString();

var Employee_Name:String = Employee_Name.toString();

var Job_Functions:String = Job_Functions.toString();

remoteObj.sendEmailFunction(Employee_ID,Employee_Name,Job_Functions);

Coldfusion Code:

<cffunction name="sendEmailFunction" access="remote" returntype="void">
    <cfargument name="Employee_ID" type="any" required="no">
    <cfargument name="Employee_Name" type="string" required="no">

    <cfargument name="Job_Functions" type="any" required="no">

<cfmail to="#mail#@yahoo.com" subject="Employee Job Functions"  type="html">


                    <b>Employee ID:</b> #Employee_ID#
                    <br>
                    <b>Employee Name:</b> #Employee_Name#
                    <br>
                    <b>Job Functions:</b> #Job_Functions#

</cfmail>

</cffunction>

This will only show the following in the email:

Employee ID: 1

Employee Name: Joe

Job Functions: Sales Representitive

How do I change  the above code so that it shows me the following:

Employee ID: 1

Employee Name: Joe

Job Functions: Sales Representitive

                      Assistant

                      Personal Secetary

Any help is appreciated.

Thanks.

314
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
Enthusiast ,
Oct 04, 2010 Oct 04, 2010
LATEST

I'm not a Flex expert but I'll guess that var Job_Functions:String = Job_Functions.toString(); only converts one field in the query result set to a string.  You need to loop through the resultset and create a Job_Functions string that includes fields from multiple rows.

You may want to ask about the correct Actionscript syntax on a Flex forum.
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