Why HTTPService is throwing error when there is two or less rows of data ?!

Hi guys,
I have an issue with HTTPService which is this.
I'm using HTTPService to retrieve data from SQL database, and to display those data in datagrid.
Basically MXML and script is like this :
example code  ---------------------------------------------------------------------
<mx:HTTPService id="readRequestC"
                                   method="POST"
                                   useProxy="false"
                                   url="http://www.mydomain.com/read_record.php"
                                   result="showActiveAlerts(event)">
</mx:HTTPService>
private function showActiveAlerts(e:ResultEvent):void
                                   C_activealerts_AC = e.result.patientalert.alert                         
end of code ------------------------------------------------------------------------
C_activealerts_AC - array collection is bound to data grid
I'm using this read_record.php file to retrieve data from database :
example code  ---------------------------------------------------------------------
<?php
define( "DATABASE_SERVER", "xxx" );
define( "DATABASE_USERNAME", "xxx" );
define( "DATABASE_PASSWORD", "xxx" );
define( "DATABASE_NAME", "xxx" );
//connect to the database.
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);
mysql_select_db( DATABASE_NAME );
$Query = "SELECT * FROM patientalert";
$Result = mysql_query( $Query );
// ----------------------------------- xml is constructed here -------------------
$Return = "<patientalert>";
            while ( $User = mysql_fetch_object( $Result ) )  
            $Return .= "<alert>
                                               <idstaff>".$User->idstaff."</idstaff>
                                               <idpatient>".$User->idpatient."</idpatient>
                                               <idalerttype>".$User->idalerttype."</idalerttype>
                                               <idalertstatus>".$User->idalertstatus."</idalertstatus>
                                                <timestampappear>".$User->timestampappear."</timestampappear>
                                               <timestampproceed>".$User->timestampproceed."</timestampproceed>
                                               <position>".$User->position."</position>
                                               <mobileid>".$User->mobileid."</mobileid>
                                               </alert>";
$Return .= "</patientalert>";
mysql_free_result( $Result );
print ($Return)
?>
end of code ------------------------------------------------------------------------
This php file above is creating nice XML file which I'm reading with HTTPService. Everything is working fine when there is a lot of data (at least several rows)
The point is, that data is changing constantly in SQL base, there can be 10 rows, but there can be 3 of them... and here is the problem.
When there is less than 2 row of data... an error appears :
TypeError: Error #1034: Can not convert type mx.utils::ObjectProxy@4011089 to type mx.collections.ArrayCollection....
I'm sure this problem is due to fact that when there is only one row in database we don't have several <alert> nodes in XML so it cannot be converted into ArrayCollection.
Do you have any idea how to prevent this ? How to convert one row of data from database to valid Array Collection... and what if there will be no data in the table... in that case I simply want to display no data in data grid !
Thanks for any help !!!

>>>> Im imagine you're feeding the HTTPService lastResult into an array collection, and then binding that to the Datagrid.
yes indeed... I'm doing precisely that :
I've got an array collection
            [Bindable]
            private var C_activealerts_AC:ArrayCollection=new ArrayCollection()
which is bound to datagrid :
<mx:DataGrid dataProvider="{C_activealerts_AC}">
             <mx:columns>
                    <mx:DataGridColumn headerText="Staff" dataField="idstaff"/>
                    <mx:DataGridColumn headerText="Patient" dataField="idpatient"/>
                    <mx:DataGridColumn headerText="Type" dataField="idalerttype"/>
                    <mx:DataGridColumn headerText="Status" dataField="idalertstatus"/> ...etc..
             </mx:columns>
</mx:DataGrid>
and I'm pushing event.result to C_activealerts_AC, like this :
<mx:HTTPService id="readRequestC"
                    method="POST"
                    useProxy="false"                   
                    url="http://www.mydomain.com/read_record.php"
                    result="showActiveAlerts(event)">       
</mx:HTTPService>
private function showActiveAlerts(e:ResultEvent):void {
     C_activealerts_AC = e.result.patientalert.alert
Now... I'm looking at your solution but I'm not quite catching it ... you have
two results in HTTPService ? Compiler doesn't like this it's shouting 'result has been defined once' !
result="handleRequestC(event)"
result="showActiveAlerts(event)"
and what is this 'Datagrid' below... is it an id of my datagrid ?? hmm..
Datagrid.dataprovider = evt.result.patientalert.alert;
Could you please explain it a little more ?
I thought if there is one row of data, array collection will be feeded only with one object... apparently, like you say, it's not
Thanx

Similar Messages

  • Is Sender File Adapter always throws error when there is no file?

    Hi,
    I have a simple question but can't find a straight answer to it. I have a Sender File adapter that configured to pick up file XXX* from FTP server every 1 hour. But a file can come every 2, 3, or 7 hours- no certain time.When there is no file I got "File not found " error. As we use alerts, this behaviour is not acceptable.
    Does this error comes always if there is no file? Any possible way to avoid this error ?
    Thanks for help.
    Nataliya

    Hi Ravi,
    I can see the error in Runtime Workbench under CC monitoring. To be precise it says:
    An error occurred while connecting to the FTP server '1X.1XX.XX.XX:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 552 RMS-E-FNF, file not found, ES4_SAP*'. For details, contact your FTP server vendor.
    My ftp server has the following set up:
    Server: xx.xxx.xx.xx
    Port:21
    Dataconnection:Active
    Timeout:120
    Connection secuirity: None
    User name .... etc set up.
    Connect mode: Per file transfer
    Transfer mode:Text
    QoS:EO
    Pollinterval: 120 (for test purposes)
    Processing Mode: delete
    Can it be that its a ftp server generates error and sends back to XI?
    Thanks,
    Nataliya

  • [Windows] file.url throw error when application executable in root directory

    Here is the bugbase ticked: Bug#3940278 - [Windows] file.url throw error when application executable in root directory
    If you launch AIR application packaged as bundle from root directory and try to get url property of any file you get IllegalOperationError.
    No matter what file url property you try to get.
    It's a big problem when you distribute your application on CD disks or flash drive.
    I'd like to ask everyone affected by this issue to take a minute and vote for the following bug.
    Thanks.

    I checked all deployment descriptions and there are no references to t3://localhost:7001. Few months back, I had the complete clustering setup working on 2 machines and now when I deploy my application on same configuration, it fails with t3://localhost:7001 unreachable error. I created a new cluster configuration on one machine with 2 managed server and it deploys fine. Can not figure out what has changed ?

  • SSRS dataset throws error when another stored procedure is called inside dataset stored procedure

    Hello;
    I am using Report Build 3.0, I have a simple report which gets data using dataset which is created from a Stored Procedure. I have another stored procedure which updates the data in the table which is used for the report. I want to get the live data on report everytime
    the report is run so that I call that stored procedure (sp_updatedata) inside my report dataset stored procedure and here where my report fails as it throws error while creating dataset.
    Here is sample:
    sp_updatedata (this only returns "Command(s) completed successfully"
    Create Proce sp_getReportData
    As
    Begin
    Exec sp_updatedata -- I call it to update the data before it displays on the report
    Select * from customers
    End
    If I remove this line it works.
    Exec sp_updatedata -- I call it to update the data before it displays on the report
    Thanks
    Essa Mughal

    Hi MESSA,
    According to your description, you create a dataset based on a stored procedure. In this procedure, it calls another procedure. Now it throws error when creating dataset. Right?
    In Reporting Services, when creating dataset, all the query or stored procedure will be executed in SSMS. So if the procedure can be executed in SSMS, it supposed to be working in SSRS. However, it has a limitation in SSRS. In a dataset, it can only return
    one result set.
    In this scenario, I don't think it's the issue of calling other procedure inside of procedure. Because we tested in our local environment, it works fine. I guess the sp_updatedata returns a result set, and the "select * from customers" returns
    another result set. This might be the reason cause the error.
    Reference:
    Query Design Tools in Report Designer SQL Server Data Tools (SSRS)
    Reporting Services Query Designers
    If you still have any question, please post the error message and the store procedure (sp_updatedata).
    Best Regards,
    Simon Hou

  • Excel is throwing error when it click print : 'No printers are installed. To install a printer click the File tab, and then click Print. Click No Printers Installed, and then click Add Printer. Follow the instructions in the Add Printer dialog box'

    Excel is throwing error when it click print : 'No printers are installed. To install a printer click the File tab, and then click Print. Click No Printers Installed, and then click Add Printer. Follow the instructions in the Add Printer dialog box'
    Word, and powerpoint application are working fine.  
    Environment :  Windows 7 64-bit, MS Office 2013 64-bit
    Steps to recreate
    (i)  Create new user account and add to any group ( do not log on using this
     account)
      (ii)  runas /user:<new user account>  <fullpath>\excel.exe
       it will ask password so enter on command prompt
    (iii)  open any excel document  and click File->Print
      (iv)  verify result  (it is failing) it pop ups below error
     Error:`Microsoft Excel
     No printers are installed. To install a printer click the File tab, and then click
     Print. Click No Printers Installed, and then click Add Printer. Follow the
     instructions in the Add Printer dialog box.                                                                                                               

    Sorry for late reply i was not at work
    I have a default set excel is still throwing error. Interestingly winword , powerpoint and publisher are working fine. I am able to print from all office applications except Excel.
     Probably excel behaves differently from other office applications.
     Probably it is a bug in excel
    Workaround : Log on to a system once using newly created account then runas excel using this account then print works fine.
    It means something in user profile should be configure to run excel print operation. Could you please somebody help what I need to configure in user profile that makes print operation success?

  • Why does fix capitalization work when there is only one space after the period in pages 09?

    why does fix capitalization work when there is only one space after the period in pages 09?  For example:  "Turn on 3rd St. After the traffic light."  There is only one space after the period in "St."  shouldn't it only auto correct after TWO spaces..??  the word After, should be after..

    You may also use a noBreak space after the period at the end of the abbreviation.
    If I remember well, in such case the capitalization will not apply.
    Yvan KOENIG (VALLAURIS, France) mercredi 27 avril 2011 23:34:46

  • Why this path doesnt work when there is "!DOCTYPE" element?

    Hi, I need to extract contents from an xml file, which looks like
    <hr />
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE article PUBLIC "-//ES//DTD journal article DTD version 5.0.1//EN//XML" "xyz501.dtd" > <!-- LINE 1 -->
    <article docsubtype="fla">
    <item-info>
    <jid>YANBE</jid>
    <aid>12941</aid>
    </item-info>
    </article>
    <hr />
    And I have tested with this path "//article/item-info/jid/text()", but it doesnt give me anything. But I noticed that when I remove line 1, it does extract the content "YANBE"...
    why the path doesnt work when there is that DOCYTYPE element? How should I get around with this please?
    Many thanks!

    The extract of XML you gave is not valid (Line 1: <hr/>) but besides that ... I think your problem is in the DTD.
    Somewhere in the DTD it probably 'sneakily' defines a default attribute which in reality is a default-namespace for one of the elements. This means that in your XPath handling, you will have to map a prefix to a namespace-uri (NamespaceContext [1]) and use this newly defined prefix in your XPath expression.
    //tst:article/tst:item-info/tst:jid/text()[1] http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/namespace/NamespaceContext.html

  • Office jet 6700 printer jam error when there is no printer jam

    I get a continuous printer jam error when there is no jam present.  I have tried connecting and reconnecting.  Same error.

    Hi @lbrockhurst 
    Although you are not experiencing a true paper jam, the solutions presented in the following document might help to resolve the issue; A 'Paper Jam' Error Displays on the HP Officejet 6600 e-All-in-One and 6700 Premium e-All-in-One Pri...
    As you will see in the document above, paper jam messages are not only a result of physical paper jams;
    The following factors can cause paper jams:
    Paper loaded incorrectly in the paper tray.
    Damaged or dirty paper rollers.
    Torn, wrinkled, or damp paper loaded in the paper tray.
    The rear access door or two-sided printing accessory (duplexer) might not be closed or is not locked into place.
    Paper was added to a stack already in the tray while the HP product was printing.
    The tray contains more than one type of paper.
    The paper is jammed inside the HP product where you cannot see it.
    An obstruction is blocking the paper path.
    Torn pieces of paper from a previous jam are stuck in the product.
    The tray is too full.
    If printing on an envelope, the edges of the envelope are bent.
    I have also seen communication hiccups cause such error messages. This may sound silly, but if the issue persists, after completing the steps in the document I provided, let's leave the router on and unplug the power cable (NOTE: Do not reset the router.),  then do the same with the printer, and shut down the computer. After a full minute, plug the router back in, wait for it to fully power up, then plug the printer back in and wait for the wireless light to become solid. Once both the router and printer are on, go ahead and turn the computer back on. Doing this will refresh the network connection. 
    I hope this heps.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Why am I getting an error when I place two OAM files one after the other in different pages?

    Why am I getting an error when I place two OAM files one after the other in different pages? They do not load or play correctly.  They are both configured to play automatically with a .125 second delay and both have a white rectangle "poster" over for a hidden effect.

    Thanks for the idea, Scott! I initially tried your idea, but my OAM files were still not loading correctly.  I tried other combinations of OAM files, and it seems to work fine.
    Back to my original OAM files: I made sure that my elements in my Edge Animate project had different names. I originally copied parts of some elements from one to another, and I think it was confusing to DPS to read it. 

  • [svn:fx-trunk] 10891: Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants

    Revision: 10891
    Author:   [email protected]
    Date:     2009-10-06 09:46:47 -0700 (Tue, 06 Oct 2009)
    Log Message:
    Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants
    QE notes: None.
    Doc notes: None
    Bugs: SDK-22676
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22676
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java

    Have you tried using com.adobe.air.crypto.EncryptionKeyGenerator instead?

  • I have just owned a macbook pro and trying to learn things since i have all along used windows laptop. My first question is : when there are two files i am working together, one above the other on screen, how you switch over between the two with key ?

    I have just owned a macbook pro and trying to learn things since i have all along used windows laptop. My first question is : when there are two files i am working together, one above the other on screen, how you switch over between the two with key ?

    Hi...
    Mac OS X keyboard shortcuts
    Control-F4
    Move focus to the active (or next) window
    Shift-Control-F4
    Move focus to the previously active window
    By the way...  since you are new to Mac, click a clear space on your Desktop. You should see "Finder" top left corner of the screen in the menu bar.
    Click Help then click Help Center
    As an example type in    keyboard shortcuts
    You can use the Help menu for almost any application on your Mac.
    Apple - Find Out How - Mac Basics
    For held switching from PC to Mac >  Apple - Support - Switch 101

  • WebI report throwing error when migrated from XIR2 to XI3.1

    I have some webi reports built in BO XIR2 on OLAP universes (SAP BW3.5 based). Recently I have migrated the reports from old XIR2 environment to a new XI3.1 environment.
    The specification of new system is as below:
    BO XI3.1
    SAP BW 3.5
    No SP and FP is installed. (Actually when I tried to install the SP2, it failed)
    After the migration, some of my reports are running for 5 minutes and then throwing an error like below:
    A database error occured. The database error text is: Error in MDDataSetBW.GetCellData. See RFC trace file or SAP system log for more details. (WIS 10901).
    The same report is working fine in old system.
    Has anyone faced this problem yet?
    Regards

    Hi Jacques,
    The transports are already imported.
    What I can see is if there is a query with only dimension objects and no measure, then that is throwing error in XI3.1. But the same query is running fine in XIR2.
    Any Idea?
    Thanks and Regards

  • C# app throws error when connecting to indesign server

    It throws this exception:
    Invalid syntax (Exception from HRESULT: 0x800401E4 (MK_E_SYNTAX))
       at System.Runtime.InteropServices.Marshal.MkParseDisplayName(IBindCtx pbc, String szUserName, UInt32& pchEaten, IMoniker& ppmk)
       at System.Runtime.InteropServices.Marshal.BindToMoniker(String monikerName)
    Caused by this line:
    InDesignServer.Application app = (InDesignServer.Application)(System.Runtime.InteropServices.Marshal.BindToMoniker("config uration_noport"));
    The server is successfully running with the no configuration parameters therefore the configuration name by default should be "configuration_noport".
    Any idea why it's throwing this error? This is a C# 4.0 console application connecting to Indesign Server CS 5 (7.0).

    Can anyone from Adobe please offer some more insight on this matter? I have encountered the excact same issues and not been able to find any answers or clues.
    Test Steps involved:
    - start a named indesign server instance in a cmd using: indesignserver -configuration testServer (and seeing that it's using 'testServer' when starting up)
    - running a sample using BindtoMoniker() always works using VS and the built-in dev WebServer and connects to my named instance 'testServer' but never with IIS.
    - tried to grant as much as possible to IIS pool identity, DCOM settings etc...no luck
    - impersonating as Admin in code and making sure the current thread is authenticated, no luck
    - all I can is to fire up new COM instances with IIS using the new:... syntax but not get the named one

  • Why Labview.ex​e error when exit simple-sta​te machine?

    Can someone please help me figure out why, unless I ABORT the VI, I get a "Labview.exe is closing" error when I press Stop. I am using a simple-state machine like what comes with Labview's examples. What could be some causes of this? I have read that not closing all files first can cause an error but it seems to me like I have them all closed.
    I am running LabVIEW 6.1 on Windows 2000. In my Initialize state I use Global and Local variables. Could these cause problems?
    Any ideas?
    Thanks,
    Lauren

    I do an AI Clear after data is acquired. I don't open up any AI functions in the "INITIALIZE" state, so I think the only AI Clear I need is where it is. WHat do you mean print the front panel without errors. I see its set to "print at completion" (the computer I use does not have a printer connection) but do you mean save the front panel to file without errors?
    Could there be an error in these subVIs that causes the program to shut down?
    Attachments:
    ReadConfigSettingsSUBVI.vi ‏72 KB
    Lines_From_File_SUBVI.vi ‏27 KB

  • Is it possible to get an output error when there is no error?

    Ok so I did a picture slide show in flash CS5 where I used actionsript 3. I added a button so that when you click it will go to the next picture. Then on the last one it will go from the last picture and reset back to the first picture. I even added some music with a stop and play button so if you are playing some music and say you get tired of it while looking through the pictures you can click the play/ stop button and it will stop.
    I got the following error in my output error-
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@64b30f99 to flash.display.SimpleButton.
    at flash.display::MovieClip/nextFrame()
    at johnexercise3_fla::MainTimeline/fl_ClickToGoToNextFrame_5()
    This error occurs when I go to test movie about half way through my photo gallery this message will pop up. The thing about it is that despite the error all my images load and play correctly as they should and my sound plays and stops as I ask it too. I guess I could ignore the error seeing as how everything works 100% fine despite the error but I was just wondering if this error is something serious or if I should be concerned? If it is something to worry about then what can I do to fix it? Again as I said the error is there but the test movie shows everything perfectly fine.

    Sorry. I may have mis-spoken. I have 2 image gallery projects. One of them has a button that you click to go from one picture to another along with a stop and play button for the music. Now my second project which is in seperate flash document is the same exact project except that instead of using a button to click from one picture to another I am clicking on the picture itself to get from one image to the next. My 2nd project is the one that had the error.  And I also kept the stop and play music button on that one. I am not sure about anything else that would have caused this code error but it went away for now. For some reason it was giving me this error and I closed out of flash and restarted as it kept acting funny at school today and for some reason the error went away. I will keep what you and kglad said in case the error comes back just do that. Thanks again to the both of you.

Maybe you are looking for

  • Problem with isDate()

    It is my understanding that isDate() assumes a US date format (eg., mm/dd/yy) The following code <cfset d = '00/01/07'> <cfoutput> #isDate( d )#<br> month: #month(d)#<br> day: #day(d)#<br> year: #year(d)#<br> day: #datePart('D', d)#<br> </cfoutput> p

  • How to decide inserting Queries into Workbooks

    Hi, I have a few doubts..pls clarify my doubts 1. How to decide inserting Queries into workbooks (How many number of Queries will be inserting into workbooks??) 2. Shall i use single sheet (or) Multiple sheets 3. We are using Hierarchy...So, How to i

  • List of DNS Negative Cache

    Hi Folks I'm having problems with what I believe to be intermittent negative responses for a host from DNS servers that we forward external queries to and those negative responses being cached. Because of the intermittent nature of the problem every

  • Error when adding AP Inv

    Hi All, When i add the A/P Invoice, it gives me error "Non Deduct Tax is missing for stock item". This happens when i select Freight in A/P Invoice. we are using 2005B PL 35. Please help to resolve Regards Shanker

  • How to use wait.for() /wait() commands for MAC? Not working...

    I am trying to run an external application on mac using runtime.exec() and it runs fine but after it runs it suddenly terminates the program. I have a waitFor() command after the runtime.exec() waiting for that program to end. If i comment out the wa