Several remoteObject call several CFC

Hello

I can't figure out how to get multiple CFC data in the same page using < mx:remoteObject / >
and get the two datagrids to show data to the loading of the page. If someone could put the example code that would be great.
I "ve google and google but can't find an answer.

Here is my code work, but I think I'm close.

---------------------------------------------------------------------
<? XML version = "1.0" encoding = "utf-8"? >
"" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "vertical".
initialize = "Employees" >

< mx:Script >
<! [CDATA]

Import mx.collections.ArrayCollection;
Import mx.rpc.events.ResultEvent;

[Bindable] private var emplist:ArrayCollection;
[Bindable] private var deptlist:ArrayCollection;
private void dataHandler(event:ResultEvent):void
{
EMPLIST = new collection ArrayCollection (event.result as Array);
deptlist = new collection ArrayCollection (event.result as Array);
}


[]] >
< / mx:Script >

< mx:RemoteObject
destination = "ColdFusion".
ID = 'employees '.
source = 'flexprojects. StaffDirectory.cfc.employeesGateway ".
result = "dataHandler (Event)" showBusyCursor = "true" "
/ >

< mx:RemoteObject
destination = "ColdFusion".
ID = "departments."
source = 'flexprojects. StaffDirectory.cfc.DeparmentsGateway ".
result = "dataHandler (Event)" "
showBusyCursor = "true".
/ >

< mx:DataGrid dataProvider = "{emplist}" >
< mx:columns >
< mx:DataGridColumn dataField = "first name" headerText = "First name" editable = "true" / >
< mx:DataGridColumn dataField = "lastname" headerText = "Last Name" editable = "true" / >
< / mx:columns >
< / mx:DataGrid >


< mx:DataGrid dataProvider = "{emplist}" / >

< / mx:Application >
------------------------------------------------------------------------------------------

Thank you
Gerd

GERD,

Try using the creationComplete attribute in the Application tag. Call a function that calls both of your CFC. and try to use two separate result management functions.

http://www.Adobe.com/2006/mxml"layout ="vertical ".
creationComplete = "init ()" > "


Import mx.collections.ArrayCollection;
Import mx.rpc.events.ResultEvent;

[Bindable]
private var emplist:ArrayCollection;
[Bindable]
private var deptlist:ArrayCollection;

public void init (): void {}
Employees.functionNameInCFC ();
Departments.functionNameInCFC ();
}

private void empDataHandler(event:ResultEvent):void {}
EMPLIST = new collection ArrayCollection (event.result as Array);
}

private void depDataHandler(event:ResultEvent):void {}
deptlist = new collection ArrayCollection (event.result as Array);
}
]]>

<>
destination = "ColdFusion".
ID = 'employees '.
source = 'flexprojects. StaffDirectory.cfc.employeesGateway ".
result = "empDataHandler (Event)" showBusyCursor = "true" "
/>
<>
destination = "ColdFusion".
ID = "departments."
source = 'flexprojects. StaffDirectory.cfc.DeparmentsGateway ".
result = "depDataHandler (Event)" "
showBusyCursor = "true".
/>


I hope this helps!

James

Tags: Flex

Similar Questions

  • What happens if RemoteObject call returns a recordset empty?

    I'm working on a plan to send a request to a cfc and return a query. The following model gives me what I want, when I come back at least 1 card.

    RemoteObject < = (Get some recordset) = > query calls CFC tbl db < = (recordcount > 1) = > event handler throws the query as an arrayCollection collection.

    But, when the cfc returns a recordcount = 0 the arraycollection collection has nothing in it to evaluate.

    In CF I use < cfif not recordset.recordcount is 0 > This

    How can I set this up in a flex project?

    Thank you.

    If you return a query with a recordCount 0, chances are flex will receive a null value or a value empty, so in your handler in Flex, you can implement an if statement in your manager who determines the action to take depending on what the cfc returns... for example:

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

    private void cfcReceiver(event:ResultEvent):void
    {
    If (event.result! = null & event.result! = ")
    {
    _arrayCollectionName = event.result as ArrayCollection collection;
    }
    on the other
    {
    do something else
    }
    }

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

    I hope this helps.

    -Tony

  • The method dynamically in RemoteObject call

    I'm trying to call a function in a RemoteObject, where the name of the function I want to call is generated programmatically. For example, the usual way to call a RemoteObject method would be something like that.

    remoteObject.methodToCall)

    I want to be able to do something like this:

    methodName = "methodToCall"; var
    remoteObject [methodName] ();

    One of the reasons I want to do it is so that I can ask for the correct method of the server name and then be able to call this method from the client side.

    Any advice?

    And I'm a fool.

    The correct way is:

    remoteObject.getOperation (methodName) .send)

    as clearly indicated in the API. Sorry to be a bother.

  • Show the Busy cursor custom RemoteObject calls

    Hello

    I try to view a customized like all busy cursor image by making calls to the remote object in flex 4 with cairngorm.

    I tried two different ways and neither worked.

    First approach - reporting style to CursorManager in the css stylesheet: -.

    CursorManager {}

    (" -busy cursor: Embed(source="/com/officemax/amps/assets/images/ball-3.jpg ");

    }

    This failed as he could not resolve namespace and I could not find either with the mx namespace or s CursorManager.

    Second approach - set cursormanager style on the initialization of the application file:-

    [Embed(source="/com/officemax/amps/assets/images/ball-3.jpg")]

    public var busyImg: Class;


    and the init method.


    styleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle ("busy cursor", busyImg);

    It works no more. This value returned CSSDeclaration class to the CursorManager but I could not see the cursor reflect.

    I don't want to set and remove the slider on each call, I want to apply it on a global scale.

    Any ideas are greatly appreciated.

    Thank you.

    StyleManager.getStyleDeclaration("mx.managers.CursorManager").setStyle ("busyCursor", busyImg);

    It worked for me

    try it on a small project and see if it works, move it to the real project. If it works in small projects and does not work in the real world, there is another process that returns the cursor. In order to put a breakpoint in the adobes withdraw of class "CursorManagerImpl" to the removeAllCursors() and other methods to see.

    Post edited by: saisri2k2

  • String returned with CFDIV calling a CFC on BIND

    Am I the only person on Earth who need to return a string instead of a numerical value when using a CFDIV BIND on a CFC? My god! It's hard to find someone who went to the same thing! I'm missing something about the real utilitity we assume what to do with a CFDIV or someone will have to explain to me! Sorry, this comment is after spending many hours (thinking I'll find my quick answer).

    Here's what I have to do. I am creating a cat using the new features in CF8. I am very close to achieve the first phase of my project. So let's say you have the big sign where the text will appear as users type their messages and a text field at the bottom where the user will type is message.

    I want to prove a point that I read for a long time now on Ajax and CF8 just reinforce it when you start explaining that we can have automated update, if we ask our functions with the asynchronous methods. This what I want to do and I try to use a CFDIV to that where I'm passing the CFC command stalemate. the system keeps me 'return' cannot be converted in the numeric form. Well, my back is actually a table of all messages in the database - formatted to display the time, the user and the message or every record.

    I see that I do not use technology properly at the moment but if anyone knows something that can redirect me to a good explanation (my brain need to understand why now that it is not logical for the moment - why I can't push into the CFDIV what I want?).

    You will find a code that will better understand how!

    Never mind! As some of you will probably notice, I have used at some point the result = result + instead of & and that was my mistake!

    Maybe the day should end now, when I got error like this and expose me like that!

    ;-))

  • call the cfc another cfc

    Hello

    I want to be able to get the value of the CodeItem of the getItem function to use for my second function getOpt .  But don't know how, you could lend me a helping hand? -Thanks


    < cffunction "getItem" access = returntype = name "remotely" = "struct" >

    < cfargument = 'wo' type name = "string" required = "yes" >

    < cfsetvarqResult = "" / > "

    < cfsetvarresult = {} / >

    < cfqueryname = "qResult" >

    SELECT * fromsaleorders

    whereprodOrder = < cfqueryparamvalue = "" #arguments.wo # "cfsqltype ="cf_sql_varchar"/ >"

    < / cfquery >

    < cfsetresult = {CodeItem = "#qResult.Code #", Description = #qResult.Description #} / >

    < cfreturnresult >

    < / cffunction >

    < cffunctionname = 'getOpt' >

    < getItem() = cfsetitemDesc / >

    < / cffunction >

  • Cannot call CFC - element TIKID is undefined in ARGUMENTS.

    Thus,.

    I use a remote object to populate a datagrid control. In the call, I'm passing 1 argument is an integer. When I run it, I get the error "Unable to invoke CFC - element TIKID is undefined in ARGUMENTS." BUT as soon as I click on continue on error, it fills the grid of data correctly. Then of course, the argument went, but flex isn't sure happy about it

    Here is the AS / code MXML.

    < s:RemoteObject "" id = "serviceEditTicket" destination ="ColdFusion" source = "prism.cfc.serviceEditTicket""">

    " < s:method name ="getEditTicket"result ="getEditTicket_result (event)"; />

    < / s:RemoteObject >

    private function creationComplete_handler(event:Event):void

    {

    serviceEditTicket.getOpenTicketsByTicketID (DataGridID.tickets_id);

    centerWindow();

    }

    I verified that DataGridID.tickets_id is a valid integer and filled with a current value of 1

    Here's the CFC with the request voluntarily omitted.

    < cfproperty output ="false">

    < cffunction name ="getOpenTicketsByTicketID" access ="at distance" returntype ="query">

    < cfargument name ="tikid" type'digital' = required ="false" / >

    < cfset var local = structNew() / >

    < cfquery name ="qGetOpenTicketsByTicketID" datasource ="#Application.dsn # ' >

    SELECT

    !!!! MY FANCY HERE SQL QUERY!

    WHERE T.tickets_id = < cfqueryparam cfsqltype ="cf_sql_integer" Value ="#arguments.tikid #" / >

    < / cfquery >

    < cftrace var =' #arguments.tikid # '>

    < cfreturn qGetOpenTicketsByTicketID>

    < / cffunction >

    < / cfproperty >

    any help will be greatly appreciated

    Must the class RemoteObject have defined CFC method, because it is not?  The argument is defined, and that you send, so perhaps that the error message is incorrect.

  • CFC and RemoteObject

    I currently have an application that calls a CFC via RemoteObject, and results are the filling of a datagrid control. How can I pass an argument to the CFC and then reload the new data. Basically, I need to be able to modify the WHERE clause in the query of my unit based on the user action.

    No spachehog your method name must remain unchanged, you send the arguments when you call the Number, so let's say that your application calls the Office receiver in a button, the code will look like this with a parameter binding.

  • Best practices for the CFC call

    Hello

    In a web application, if I need to call a method on a different CFC CFCS, which would be considered as the best way to do it?

    For example, let's say I have two components: Customer and Product.  A method functionA to the customer, I want to call product Featureb.  I can do one of the following values, but how is recommended and why?

    1. create an object produced in functionA and use it to call Featureb

    < cfproperty name = "Customer" >

    < cffunction name = "functionA" >

    < cfset productObj = createObject ("component", "Product") >

    < cfset productObj.functionB () >

    < / cffunction >

    < / cfproperty >

    2 pass a product object when we initialize a Customer object and use it to call Featureb

    < cfproperty name = "Customer" >

    < cffunction name = "init" >

    < cfargument name = "productObj" >

    < cfset variables.productObj = arguments.productObj >

    < / cffunction >

    < cffunction name = "functionA" >

    < cfset variables.productObj.functionB () >

    < / cffunction >

    < / cfproperty >

    3. place the assumption that Customer object has access to the object in the scope

    < cfproperty name = "Customer" >

    < cffunction name = "functionA" >

    < cfset application.productObj.functionB () >

    < / cffunction >

    < / cfproperty >

    Thank you very much.

    I would like to use method 1 because it gives you the flexibility of most.  While your known current requirements may dictate that it be necessary to call the cfc 100% of the time product you call customer support CFCs, something might happen in the future when it is not.  Method 2 would be ineffective because it running unnecessary code.

  • The repeated CFC function call is much slower than the UDF version

    For a project, we were faced with unexpected behavior of a CFC. Without going to much into the details of the project, it boils down to the following: when we run through a set of records, say 100 and apply a function to this topic, the overhead is 4-5 seconds extra when we call it a component instantiated (only once) compared to when code us as a UDF. Since our application can process thousands of records in 1 past the overload will quickly over 100 seconds compared to the UDF.

    I was wondering if there is no logical explanation for this behavior. From what I understand a function called from a component should not add any notable overload after the component was instantiated.

    Our installation is an installation of Coldfusion 8 Jrun running on Linux. We didn't really find anything on the web documenting this (or we found we have said that there will be no additional charge). We could modify the function call to a call from the UDF, but we prefer to keep in a CFC as there are more things behind the scenes that just formatted data.

    B.

    HA!  Cool!!! I think I solved it something, I feel so proud.

    I run the code of Adam and the first time I ran it I got similar to Biebel3 results.  But it's curious, I got the output of debug it showing that it wasn't show where the time was spent.  He would show almost two full seconds to build the page of CFCS, but the components in the table of debugging only added up to about 50 milliseconds.

    I tired first put a top of the page of CFC, but that has not changed the results.  Because even if you do not display the results, ColdFusion still satisfied the debug output.  I went into the administrator and effectively disabled the debugging feature.

    Alto, I started to have the results displayed by Adam.

    It seems that it is a question where it takes a lot of overhead for ColdFusion compile a record of debugging for each call of CFC in this large loop.

    The good news, this is a pretty easy solution for a production system.

  • class .as CFC method call

    so I got a .swc and I was informed that its got a method called doSomething();

    for one reason or another, I can't include the swf file in my fla. what I need to do, it's somehow include the swc in an AS3 class and then call the CFC method therefrom.

    so I got it here, in a directory called 'swc' sound called 'someSWC.swc' and I need import into someClass.as and call the doSomething() about it.

    and I have no idea how I would... anyone?

    Hi andrei1

    of course, Ive had to bash my head against this for a few days to find a solution. Yes I found out that if you can bust open a CFC as you suggest it you find an xml file that indexes the content of CFC and a swf file that contains the different methods/assets/graphics/etc. When you look in the tags in the XML indexical you can find references to AS3 objects like this:

  • Sharing of CFCS with Flex projects

    I am building a large application that runs our company to replace the old CF/Flash app that I built myself over the past 6 years.
    I use Flex and Cold Fusion CFCS to build the application from scratch.
    This application will consist of 100 lots of smaller applications that handle:
    User management, inventory, specifications, contracts, invoices, missing reports and damage, racing truck etc.

    First of all, I built our ordering system, and then I built the system of inventory.
    I built as separate Flex projects and saw that they used a lot of the same CFC (that I created in each project) and that down the line, I have to change many CFCS and Actionscript (models) if valuables projects I made any changes to the tables of database they called.

    I want to create a set of objects of value of CFCS and Actionscript can be used by any project I'm doing on this site.

    I create these CFCS and files as with "Create CFC" Wizard of Cold Fusion.

    I have seen that I have to change the way I worked in separate projects.

    I thought to do a Flex project with many applications in it, but it seems that it fits well over time and could become a mess.

    It seems to me that in order to make a library Flex project that stops my .as models files and I might add that the library to each project, but I don't think I can call CFCS in this way.

    I could make and publish a Flex project that does nothing but keep the EFA and point my call of remote object to this project but I would not be able to call the .as files, unless I've referenced this project and this solution began to feel like one of my hacks classics that would be a bad choice over time

    Any advice on the errors of global architecture that I do and how I should build to put these assets available to all of my projects/scheme?

    If you want to use the same as classes in several projects, you certainly want to use a Flex library. Your ActionScript classes will be back in a SWC that you can use in the libraryPath of any another Flex project.

    I create and maintain CFCS separately of Flex projects. The reason is that you need to treat them as if you bought them from a third party and want to keeping them on a separate development cycle. For example, A project moves to version 1.5 and needs a change to one of the CFC. You don't want to have to deal with project B who always uses the version 1.0. If you were to buy these CFCS starting from somewhere, how would you be excited? Use it as a guideline.

    Your commune THAT classes that are the counterparts of CFC probably not say much without CFC. So I would include in this library Flex an interface class (RemoteObject) with CFCS that the EFA is independent. Once again, if you need to add or change an AS file in response to a change in the CFC, you have better version control keep these together. Yet once, treat it as a third-party product.

    If your library Flex (in the FORM of classes + RemoteObject calls) now becomes your API for your applications.

    One final note: your projects seems ideal for Flex 2.0.1 Modules. I wrote them a quick presentation on my blog and you can read more about them in the Flex livedocs under creating modular Applications..

    Good luck!

  • location of CFC

    I'm trying to create a folder in the Web root named "nom_de_dossier" to contain all my sites swc files. My problem is that on my computer, in the coldfusion wwwroot folder, I have several websites to clients in their own records. I need to keep my computer as the test server, then the remote server as the real live web site. The problem is that I have to call the compenent using a different location on the test vrs server in the server in remote site online. For example, the test server is wwwroot/clientname/foldername/name.cfc while the shared hosting location is wwwroot/foldername/name.cfc.

    Does anyone have a simple suggestion so that I don't have to rewrite all my files before you download them and then rename them when I want to use the server remote server vrs or create a variable in the application.cfc to modify when you use different locations?

    Thank you

    Or use the functionality of ColdFusion mapping that was created for this purpose.

    On the development computer, you create a map named "nom_de_dossier" pointing to wwwroot/clientname/foldername.

    On your hosting create a mapping named "nom_de_dossier" pointing to wwwroot/foldername.

    Then just call your CFC with the path "foldername.name", CF will use the mapping, unless there is a local path that matches the pattern of thie first.

    Of course, if you don't control the configuration of your hosting coldfusion, you will have to apply to have such a mapping created.  All wothy name hosting provider will be a process to make such a request or an administration tool for you to do it yourself.

  • How to access a CFC outside the web root

    I need to access several of the CFCS that are sitting outside the web root, however, I can't seem to find the right way to call the component.  For example... My Flex project is located in a folder under the web root.  My CFC sit in a folder at the same level as the web root.

    To illustrate:

    The web root is c:\coldfusion8\wwwroot

    CFCS are in a folder c:\coldfusion8\com

    A CFC that I need to access is named fxCFC and is located at c:\coldfusion8\com\fxCFC.cfc

    The Flex project is named fxProject and is located at c:\coldfusion\wwwroot\fxProject

    The application is called main.mxml and resides in c:\coldfusion\wwwroot\fxProject\src\main.mxml

    I can't call the CFC using "com.fxCFC" as my compiled application cannot see the component.  I guess that since the CFC to sit above the root.  Is there a way I can access?

    Thank you!

    Man I feel so stupid, I forgot the option in the remoting-config. XML which allows you to turn on the mappings.

    It is the solution, your wwwroot CF proceed to web-inf/flex/services-config.xml, search for and modify

    false
    

    for this

    true
    

    Restart the servers and maps to start working.

    I'm so stupid sometimes.

  • Access ColdFusion CFCS with Flash Builder

    Is it possible to access CFCS for the development on a remote server without access to the shared network drive?

    Thank you

    Yes.  No need to local CF or LAN Server.

    Everything you need to access http server via the url of the remote endpoint CF in your remoteObject call http://www.yourdomain.com/flex2gateway/

    When debugging or running the web application or the Flex air locally, you can always get your remote server data of CF.

    <>

    ID = "cfdata" showBusyCursor = "true".

    "destination ="ColdFusion"endpoint ="http://www.yourdomain.com/flex2gateway/"

    source = "mycfcpath.mycfc" > "

    I hope this helps.

    Don

Maybe you are looking for

  • Satellite M300 PSMD4A - Windows Vista is unable to load the user accounts

    OS: Vista Business 32 bModel: Toshiba Satellite M300 (PSMD4A) Problem: When I turn on the laptop it charges upwards which is usually the login screen, but it does not display * all * accounts of users and, therefore, it is impossible to connect!Surve

  • 13.1 error with new rolls

    I have a laserjet 4200 who keeps giving me an error 13.1 even if she new rolls on it. I tried 2 different trays and always get the same result. I try to print a paper proof of path with a quantity of 100. After about 25 to 30 pages, I get an error 13

  • HP 250 g3 - adjusment brightness keys don't work!

    Windows 7 x 64. The function keys F2 and F3 could control the brightness of the screen, but they do not. Is there any driver what should I install? I'd be happy if someone advises me. Thank you.

  • adding members again contact group

    In my mailer Windows, under contacts, I want to enter a new contact group. After the designation of the group, the program will not let me add members of my address book regardless of how I try to do.

  • AAA accounting in charge of the Windows 2008 network POLICY server log

    Hello world We have configured our Cisco devices to use Windows 2008 network POLICY server for RADIUS.  However, we cannot configure aaa represents priv 15 commands to use the same radius servers for recording of commands in privileged mode.  When yo