8 Replies Latest reply on Jul 19, 2010 4:22 PM by docwisdom

    Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.

    docwisdom Level 1

      Sooooo,

       

      I am using a remote object to populate a datagrid. In the call, I am passing 1 argument that 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 continue on the error, it populates the datagrid properly. So obviously the argument is being passed, but flex sure aint happy about it.

       

      Here is the AS/MXML code.

       

      <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 have verified that DataGridID.tickets_id is a valid integer and populated with a current value of 1

       

       

      here is the CFC with the query purposely omitted.

       

      <cfcomponent output="false">

      <cffunction name="getOpenTicketsByTicketID" access="remote" returntype="query">

      <cfargument name="tikid" type="numeric" required="false" />

      <cfset var local = structNew() />

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

      SELECT

       

      !!!!MY FANCY SQL QUERY HERE!!!!

       

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

      </cfquery>

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

      <cfreturn qGetOpenTicketsByTicketID>

      </cffunction>

      </cfcomponent>

       

       

       

      any help will be greatly appreciated

        • 1. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
          John Hall Level 4

          Sounds to me like a timing issue. Are you sure you're not trying to access the data before the resultObject is returned from CF?

          Do you have a result handler so that it will fire asynchronously when the object arrives or are you trying to use the data right away?

          • 2. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
            flex.net

            Does the RemoteObject class need to have the CFC method defined, because it doesn't?  The argument is defined, and you're sending it, so maybe the error message is inaccurate.

            • 3. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
              docwisdom Level 1

              From the documentation I have gone through, I dont see a type property to the method tag. Maybe you could show me an example. All that seems to be required is name and result.

              As for the order in which the functions are being called, I placed a trace(DataGridID.tickets_id) in the creationComplete_handler just before serviceEditTicket.getOpenTicketsByTicketID(DataGridID.tickets_id); and it properly returns a numeric value of 1.

              This is exactly what I am expecting and hoping to pass to the CFC.

              • 4. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
                flex.net Level 1

                I meant that the method you're calling was not defined in the MXML code:

                 

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

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

                 

                <s:method name="getOpenTicketsByTicketID"  result="getOpenTicketsByTicketID_result(event);">

                  <s:arguments>

                     <tikid></tikid>

                  </s:arguments>

                <s:method>

                </s:RemoteObject>

                 

                I've solely used RemoteObjects defined in MXML.  I know it can be done defined in AS, but it looks like you have a mix of both.  On a long shot try adding the getOpenTicketsByTicketID method to the mxml and see.

                1 person found this helpful
                • 5. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
                  docwisdom Level 1

                  haha

                   

                  Solved!

                   

                  I was totally calling the wrong function in the datagrid creationcomplete handler.

                   

                  you had it right!

                   

                  thanks

                  • 6. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
                    docwisdom Level 1

                    Ok, Im not completely done, maybe you guys can help me with this too.

                     

                    now I have it working with my datagrid dataprovider set to  dataProvider="{serviceEditTicket.getOpenTicketsByTicketID.lastResult}"

                    Since the datagrid was only a test dump to make sure I was getting data, I need to now put the results into an array collection and be able to reference the fields individually. Bare in mind this query is only returning 1 record. It is the details of the specific support ticket. Should I use an array instead of an array collection?

                     

                     

                    So Im trying to do something like this, but it doesnt seem to work.

                    [Bindable]

                    private var getEditTicket:ArrayCollection;

                    private function getOpenTicketsByTicketID_result(event:Event):void

                    {

                    getEditTicket = serviceEditTicket.getOpenTicketsByTicketID(DataGridID.tickets_id).lastResult as ArrayCollection

                    centerWindow();

                    }

                     

                    then set the dataprovider as getEditTicket.....but no go

                     

                     

                    Second

                    Once I get the ArrayCollection populated properly, how do I reference the individual fields?

                    Like i want to set a label text as column "ticket_id" or "category" or maybe set the default text in an textinput to the column "issue_subject" from my SQL query.

                     

                     

                    Thanks!!

                    • 7. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
                      flex.net Level 1

                      change it to

                       

                      getEditTicket =  event.result.qGetOpenTicketsByTicketID as ArrayCollection;

                       

                      because the RemoteObject has already been executed. (You might have to change your CFC to return <cfreturn response.qGetOpenTicketsByTicketID>.)

                       

                      For the DataGrid, if you don't specify the data columns, it will automatically display all the fields within the ArrayCollection.  If you'd like only certain fields to display, you'll have to specify which ones.  See Specifying columns under this link http://livedocs.adobe.com/flex/3/html/help.html?content=dpcontrols_6.html#396858 to get started.

                      • 8. Re: Unable to invoke CFC - Element TIKID is undefined in ARGUMENTS.
                        docwisdom Level 1

                        Thanks very much.

                         

                        I actually am not using a datagrid at all now. I was just using it to test with ...kinda like a cfdump. When I said columns before, I was referring to the mySQL columns, not the datagrid. Sorry for the ambiguity.

                         

                        What I want to populate are labels, textinput boxes and comboboxes. I need to know how to reference each element in the arraycollection and assign them to the different labels, etc. My logical side of my brain says that it should be getEditTicket.getItemAt(0).valueOf(ticket_id) but no luck.

                         

                        Basically what I am trying to do is doubleclick the ticket in the main application, then pass the ticket ID to the titlewindow component where you can edit the information in textinput and combobox form. Then be able to click save and update.

                         

                        _____

                         

                         

                        I am trying your arraycollection code right now. Somehow my original handler was an event handler not a resultevent handler, so once I added the event.result to it I got a coersion error. I then changed the event handler to a resultevent but it doesnt seem to be populating.

                         

                         

                         

                         

                        THANKS!!!