Retrieving data from a MATLAB script node
I am creating a VI that imports and manipulates arrays of data points and then plots them in Labview. When I run my Matlab script in Matlab there are no errors and all the assigned variables exist in the form that they should exist but for some reason Labview cannot retrieve all of them (they just show up as zeros). There are no errors in the script as far as I can tell. Do you have any idea what could be going wrong?
Hi,
You can use the MatLAB window opened by LabVIEW to debug your script.
Check the values of your variables in the MatLAB window and try to find out where the data goes wrong. I've experienced many problems with LabVIEW MatLAB nodes on different PCs, and many times legal MatLAB operations would go wrong in the script node. You will need to find out which line exactly does your MatLAB code not executing correctly and try to modify the MatLAB codes from there.
Hope this help,
Dan
Similar Messages
-
Input data type of Matlab script node
Hi,
I have 1D array of complex number in single precision.
Matlab script node is used to import data into Matlab and do some data processing, and then export.
Data type of input is currently double precision.
How to re-define this input data type of the Matlab script node?
Thanks,Right, arrays of singles are not supported. See Comparison of MathScript RT Module and the MATLAB® Software Data Types in LabVIEW
As for memory usage, Profiling the VI should let you know how much memory Labview uses when running your code. Communication with MATLAB® is done through ActiveX, and I'm actually not 100% sure whether it will reflect memory usage from script execution. I think it'll be simple enough to profile your VI with and without the MATLAB Script node and note the memory usage difference...
Misha -
How to insert data from file into matlab script node
I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice
Zarina,
To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
Regards
Tristan -
Matlab script node for real time purpose
Hi!
We are trying to control in real time the frequency of a vibration motor with a voltage signal proportional to EMG activation.
Our EMG sends data to a LAN port and we read them in Labview using the UDP Read function.
We created a VI which reads data from UDP connection, parses the header and does the decoding (according to the data type of our EMG device, TMSi Porti).
Every sample read from UDP port is passed to the Matlab script node which implements a Bayesian filter which returns a value (MAP) used to control the vibration frequency.
The problem is that this operation is extremely slow...(about 15 seconds!!) and we need it to be real time!
We tried also a simple MA filter and the delay is reduced to around 2 sec, so we think that the major problem is in the Matlab script node.
We wonder if this delay is due to the call of an external code (Matlab) or to the complexity of the Matlab code itself.
Do you know how to improve the performance of this VI?
Thank you!
Serena
Attachments:
EMGreceiver+Bayes.vi 54 KBSerena
I noticed that your code also have LabVIEW MathScript RT code. Have you tried to replace the Matlab scriptnode with it? The MathScript Node compiles the script natively into G function and avoid transfering information between programs.
If this does not speedup your application, please attach the subVIs and test data that allow us to reproduce the problem and performance. Also, what is the version of LabVIEW that you are using? If it is before LabVIEW 2009, then I would strong recommend update to that version.
Barp - Control and Simulation Group - LabVIEW R&D - National Instruments -
Error 1050 by trying to use load'filename' in matlab script node
Hi
I keep getting error 1050 when Labview tries to load a text file through the matlab script node.
I've all ready checked for it on google and this forum but found nothing. I've also done this: http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53 and tried to use dlmread and more.
The thing is that I need the matlab script node to read a txt file that Labview made from a chart with only 1 array, plot it and export a jpg image. I can't really use the 'export image' or 'get image' function in Labview cause I need the whole plotted chart (these functions only take a snap shot of it when they're run).
This is my code that I'm using:
data=load('file') ;
Vpp=(data(1:2000,1));
xsize = (1/2000);
plot(0.0005:0.0005:1,Vpp);
axis([0 1 -5 5]);
print('-djpeg', 'graph.jpg');
The usual load in matlab to load txt files and print to print the jpeg. The code works in matlab but not in labview
And yeah, I'm using windows 7 and legal versions of matlab r2009b and Labview 2009
Solved!
Go to Solution.
Attachments:
matlab.jpg 213 KBYes I forgot, this is my error... It looks like it can't read the file path, but the 'file' path is actually just a path to my c:\user\*\*\*\*.txt
Error 1050 occurred at LabVIEW: Error occurred while executing script. Error message from server: ??? Error using ==> load
Unable to read file file: No such file or directory. -
Retrieve data from a list in SharePoint 2013 provider hosted App using CSOM
I have developed a provider hosted app in SharePoint 2013. As you already know, Visual Studio creates web application and SharePoint app. The web application gets hosted inside IIS and the SharePoint App in SharePoint site collection. I'm trying to get
data from a list hosted in SharePoint using CSOM. But I get ran insecure content error.
here is my code in Default.aspx
<script type="text/javascript" src="../Scripts/jquery-1.8.2.js"></script>
<script type="text/javascript" src="../Scripts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../Scripts/SP.Core.js"></script>
<script type="text/javascript" src="../Scripts/INIT.JS"></script>
<script type="text/javascript" src="../Scripts/SP.Runtime.js"></script>
<script type="text/javascript" src="../Scripts/SP.js"></script>
<script type="text/javascript" src="../Scripts/SP.RequestExecutor.js"></script>
<script type="text/javascript" src="../Scripts/App.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="Get title via CSOM" onclick="execCSOMTitleRequest()" /> <br />
<input id="Button2" type="button" value="Get Lists via CSOM" onclick="execCSOMListRequest()" />
</div>
<p ID="lblResultTitle"></p><br />
<p ID="lblResultLists"></p>
</form>
</body>
</html>
and App.js is:
var hostwebUrl;
var appwebUrl;
// Load the required SharePoint libraries
$(document).ready(function () {
//Get the URI decoded URLs.
hostwebUrl =
decodeURIComponent(
getQueryStringParameter("SPHostUrl")
appwebUrl =
decodeURIComponent(
getQueryStringParameter("SPAppWebUrl")
// resources are in URLs in the form:
// web_url/_layouts/15/resource
var scriptbase = hostwebUrl + "/_layouts/15/";
// Load the js files and continue to the successHandler
//$.getScript(scriptbase + "/MicrosoftAjax.js",
// function () {
// $.getScript(scriptbase + "SP.Core.js",
// function () {
// $.getScript(scriptbase + "INIT.JS",
// function () {
// $.getScript(scriptbase + "SP.Runtime.js",
// function () {
// $.getScript(scriptbase + "SP.js",
// function () { $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest); }
function execCrossDomainRequest() {
alert("scripts loaded");
function getQueryStringParameter(paramToRetrieve) {
var params = document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve)
return singleParam[1];
function execCSOMTitleRequest() {
var context;
var factory;
var appContextSite;
var collList;
//Get the client context of the AppWebUrl
context = new SP.ClientContext(appwebUrl);
//Get the ProxyWebRequestExecutorFactory
factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl);
//Assign the factory to the client context.
context.set_webRequestExecutorFactory(factory);
//Get the app context of the Host Web using the client context of the Application.
appContextSite = new SP.AppContextSite(context, hostwebUrl);
//Get the Web
this.web = context.get_web();
//Load Web.
context.load(this.web);
context.executeQueryAsync(
Function.createDelegate(this, successTitleHandlerCSOM),
Function.createDelegate(this, errorTitleHandlerCSOM)
//success Title
function successTitleHandlerCSOM(data) {
$('#lblResultTitle').html("<b>Via CSOM the title is:</b> " + this.web.get_title());
//Error Title
function errorTitleHandlerCSOM(data, errorCode, errorMessage) {
$('#lblResultLists').html("Could not complete CSOM call: " + errorMessage);
function execCSOMListRequest() {
var context;
var factory;
var appContextSite;
var collList;
//Get the client context of the AppWebUrl
context = new SP.ClientContext(appwebUrl);
//Get the ProxyWebRequestExecutorFactory
factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl);
//Assign the factory to the client context.
context.set_webRequestExecutorFactory(factory);
//Get the app context of the Host Web using the client context of the Application.
appContextSite = new SP.AppContextSite(context, hostwebUrl);
//Get the Web
this.web = context.get_web();
// Get the Web lists.
collList = this.web.get_lists();
//Load Lists.
context.load(collList);
context.executeQueryAsync(
Function.createDelegate(this, successListHandlerCSOM),
Function.createDelegate(this, errorListHandlerCSOM)
//Success Lists
function successListHandlerCSOM() {
var listEnumerator = collList.getEnumerator();
$('#lblResultLists').html("<b>Via CSOM the lists are:</b><br/>");
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
$('#lblResultLists').append(oList.get_title() + " (" + oList.get_itemCount() + ")<br/>");
//Error Lists
function errorListHandlerCSOM(data, errorCode, errorMessage) {
$('#lblResultLists').html("Could not complete CSOM Call: " + errorMessage);
Any solution is appreciated.Hi,
To retrieve data from list in your provider-hosted app using SharePoint Client Object Model(CSOM), you can follow the links below for a quick start:
http://msdn.microsoft.com/en-us/library/office/fp142381(v=office.15).aspx
http://blogs.msdn.com/b/steve_fox/archive/2013/02/22/building-your-first-provider-hosted-app-for-sharepoint-part-2.aspx
Best regards
Patrick Liang
TechNet Community Support -
Retrieve data from a dynamic page via loadURL
Hello.
I would like to ask you how it is possible to retrieve data
from a dynamic page (asp classic in my case) using the loadURL
method.
I would like to create an html authentication form (with
username and password fields). The loadURL method should call an
asp page and then pass to the usual function 'DoIfSucceded' the
results of the elaboration.
Of course I'm going to have a switch in the function in order
to make different actions depending from the results of the asp
page (authentication succeded or failed).
I had a look to the examples at this page:
Adobe
samples
Is there anyone who can explain clearly how the results data
must be written by the asp page and how the success function can
retrieve them ?
I thank you in advance for your help.loadURL() uses the the XMLHttpRequest Object so if the
content you return is XML, you have 2 choices for accessing your
data. You can either access it as a text string via the
XMLHttpRequest object's responseText property, or as a DOM document
via the XMLHttpRequest object's responseXML property:
function MySuccessCallback(req)
// If my data is XML, I can access the data that was sent
from the server
// as DOM elements via the XMLHttpRequest's responseXML
property.
var xmlDOM = req.xhRequest.responseXML;
// OR, you can access the data sent back from the server as
text via
// the XMLHttpRequest object's responseText property.
var xmlAsAString = req.xhRequest.responseText;
var req = Spry.Utils.loadURL("GET",
"/app/book.php?id=1&code=54321", true, MySuccessCallback);
If your serverside script wants to use some other format as a
response like JSON or plain text, then you can only access the data
as text via the responseText property.
--== Kin ==-- -
Retrieve data from a non-peoplesoft application using HTTP Get
I need to retrieve data from a non-peoplesoft application. They want us to submit a HTTP GET request to their URL with a series of parameters. I am thinking about using HTTP Targert connector to accomplish this. Does anyone have sample peoplecode?
Currently we are on 8.51.10 Tools...
If there is any better way .. please let me know ..I have used HTTP Get to get XML file from a government sanction list by hitting URL http://www.treasury.gov/ofac/downloads/sdn.xml
There is a delivered PS program that does that for vendor sanctions. I had to get the online setup correctly by creating a new custom Node with HTTP Target Connector. The program name is BSP_IMPORT. The below code is responsible for the calling the node and retrieving the data. Play around with the code below see if you can get it to meet your needs.
BSP_IMPORT_AET.BANKNODE.Value is just the custom external code that I created.
PMT_FLAT_FILE_INBOUND message is just a none rowset based message to use the web service call.
Local TR:FileUtilities:FTP &oFTPUtil = create TR:FileUtilities:FTP();
+/* HTTP */+
+/*******************************************************************************/+
Local Message &msgHTTP;
Local Message &msgResult;
+&msgHTTP = CreateMessage(Message.PMT_FLAT_FILE_INBOUND);+
+&oFTPUtil.PopulateFTPGetIBInfo(&msgHTTP, BSP_IMPORT_AET.BANKNODE.Value);+
+&msgResult = %IntBroker.ConnectorRequest(&msgHTTP);+
+/* check to see if the file is wrapped */+
+&strAllLines = &msgResult.GenXMLString();+
+&strAllLines = Substitute(&strAllLines, Char(26), " "); /* Added this line to remove invalid characters */+
+/*******************************************************************************/+
Edited by: Maher on Mar 20, 2012 3:28 PM -
Problem retrieving Data from a CDATA-Section using XMLDOM
Hello,
Ware: Oracle 8.1.7.4 64bit, XDK for PL/SQL Version 9.2.0.3, Solaris8 64bit
I can't retrieve Data from the CDATA-Section of an XML-String, neither with
getData(DOMCharacterData) or substringData. Also getLength fails. I get always
the following error:
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.ClassCastException
ORA-06512: at "XML_SCHEMA.XMLCHARDATACOVER", line 0
ORA-06512: at "XML_SCHEMA.XMLDOM", line 853
ORA-06512: at "SCHWABE.XML_TEST", line 47
ORA-06512: at line 1
I can successfully cast the DOMNode to a CharacterData with makeCharacterData
and check with isNull (DOMCharacterData) (returns FALSE).
My Testcase:
1) A Function which build a XML-Document:
CREATE OR REPLACE FUNCTION XML_ResponseCalc RETURN VARCHAR2 IS
doc VARCHAR2(32767);
BEGIN
doc :=
'<?xml version="1.0" encoding="UTF-8"?>
<RSDecEng>
<Version>1.00</Version>
<ResponseCalc>
<ID>00000000000000000014</ID>
<Burst>
<Definition>
<Count>1</Count>
<ID>
<Start>1</Start>
<Length>4</Length>
</ID>
<Var>
<Name>Risiko_1</Name>
<Start>5</Start>
<Length>5</Length>
</Var>
</Definition>
<Data>
<Length>9</Length>
<Count>5</Count>
<![CDATA[
1 0.001
2 0.002
3 0.003
4 0.004
5 0.005
6 0.006
7 0.007
8 0.008
9 0.009
10 0.010
]]>
</Data>
</Burst>
</ResponseCalc>
</RSDecEng>
2) The Procedure which parses the XML-Document (no Exception-Handling):
CREATE OR REPLACE PROCEDURE XML_TEST IS
Parser XML_SCHEMA.XMLParser.Parser;
DOMDocument XML_SCHEMA.XMLDOM.DOMDocument;
DOMNode XML_SCHEMA.XMLDOM.DOMNode;
DOMNodeItem XML_SCHEMA.XMLDOM.DOMNode;
DOMNodeList XML_SCHEMA.XMLDOM.DOMNodeList;
DOMCharacterData XML_SCHEMA.XMLDOM.DOMCharacterData;
TheDocument CLOB;
ID VARCHAR2(100);
Data VARCHAR2(200);
BEGIN
-- LOB
DBMS_LOB.CREATETEMPORARY(TheDocument, TRUE);
DBMS_LOB.WRITEAPPEND(TheDocument, LENGTH(XML_ResponseCalc), XML_ResponseCalc);
-- Parse
Parser := XML_SCHEMA.XMLParser.NewParser;
XML_SCHEMA.XMLParser.ParseCLOB(Parser, TheDocument);
DOMDocument := XML_SCHEMA.XMLParser.GetDocument(Parser);
XML_SCHEMA.XMLParser.FreeParser(Parser);
-- Node
DOMNode := XML_SCHEMA.XMLDOM.MakeNode(DOMDocument);
-- Get ID
DOMNodeList := XML_SCHEMA.XSLProcessor.SelectNodes
(DOMNode,'/RSDecEng/ResponseCalc/ID/text()');
IF XML_SCHEMA.XMLDOM.GetLength(DOMNodeList) > 0 THEN
DOMNodeItem := XML_SCHEMA.XMLDOM.Item(DOMNodeList, 0);
XML_SCHEMA.XMLDOM.WriteToBuffer(DOMNodeItem, ID);
SYS.DBMS_OUTPUT.PUT_LINE ('ID: '||ID);
END IF;
-- Get CDATA
DOMCharacterData := XML_SCHEMA.XMLDOM.MakeCharacterData(DomNode); -- <-- ok here...
IF NOT XML_SCHEMA.XMLDOM.isNull (DOMCharacterData) THEN -- <-- ...and here
Data := XML_SCHEMA.XMLDOM.GETDATA(DOMCharacterData); -- <-- ...but here Exception raise
END IF;
END;
I hope you can help me.
Thank you in advance
Markus SchwabeYou need to notice the definitions for makecharacterdata:
FUNCTION makeCharacterData(n DOMNode) RETURN DOMCharacterData;
PURPOSE
Casts given DOMNode to a DOMCharacterData
It only do the casting. -
Retrieving data from TCP/IP in xml and displaying values?
Hey, I am using a program to retrieve data from a machine and outputting it in xml to the localhost. On a seperate computer, I am trying to create a client application to read the xml data from that IP host and just output the important values instead of the whole script. I am new to Labview and programming, has anyone written a program similar to what I am trying to accomplish? I searched for it but couldn't quite find what I was looking for. I really could use some help with trying to figure this out and appreciate any help or advice you could give me.
Where did you search? There are examples that ship with LabVIEW that show you how to do client-server applications using TCP/IP. Did you try those? You would need to add the parsing of the data you receive (i.e., the XML).
-
Basic TableUI element to Retrieve Data from DB in WEbDynPro For Java
Hi Experts,
I am new to WebDynPro for java.Can any body please help me out from this issue.
I am trying to display records from DataBase by Using Table UI element.
DBTable Contains 10 rows.
I have created a Node and Attributes(for every column) .
I am using JDBC code to retrieve data from database and assigning to Attributes.
But in Table UIElement its displaying only last record from database as first row in UIElement.
Its over writing previous rows.
Can any body please help me the correct procedure to retrieve data from DataBase.
Thanks and Regards,
Shashikiran.BHi,
Iterate through the result set object
populate the context node
Ex:Replace the context nodeName with that of yours.
ResultSet resultSet = stmt.getResultSet();
//Iterate through the resultset
while(resultSet.next())
//Create element of the context node
IWDNodeElement nodeElement = wdContext.nodeOrders().createElement();
//assign value from the database to the context attribute
//Replace attributeName with your attribute name
//Replace value with resultSet.getShort("<ColumnName>")
nodeElement.setAttributeValue(attributeName, value);
//Add the element to your node
wdContext.nodeOrders().addElement(nodeElement);
Regards
Ayyapparaj -
IMAQ FFT multiplication and MATLAB Script Nodes/Compact Rio
I would like to automatically generate a frequency kernel to multiply with the FFT of my IMAQ image. I was wondering if there was a way for LabVIEW to automatically set up 2D arrays (with a lower bound, a step size and a higher bound) like what is done in MATLAB.
I was wondering also, if someone could give me some insight as to what restrictions I face, when uploading code from MATLAB script nodes into the Compact RiO (I have a cRiO-9025).Hi Bilaln,
I think you confused about a MATLAB script node and a Mathscript node.
A MATLAB script nodes uses ActiveX to call into MATLAB, where as a Mathscript node runs in a NI built environment. The MATLAB script node requires both that MATLAB be installed and the host supports ActiveX. Since cRIO does not do either, you should use the MATHSCRIPT RT module.
Joe Daily
National Instruments
Applications Engineer
may the G be with you .... -
I want to be able to catch errors that occur during the execution of Matlab code in a LabVIEW Matlab script node. According to my understanding of the documentation, errors of this type should be available at the "error out" signal point on the Matlab script node. I have noticed that even deliberately generating matlab syntax errors will not produce an error output. See the attached vi for an example.
Attachments:
matlab.vi 13 KBI ran your example VI and the is what I got in the Error Out cluster:
"Code 1050
Error occured while executing script. Error message from server: ??? This is an error
. in matlab[1].vi"
If you are generating custom error messages in Matlab I would suggest passing them back to LabVIEW through output variables in the script node.
Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect -
Re: Retrieving data from the check box group.....
Hi all,
I am new to webdynpro Java. I'm facing a problem while retrieving data from the check box group..
I've taken a simple type "Status" and Node with value attribute named status and set the property of that attribute as the simple type. This attribute is bound to the checkboxgroup.The cardinality of the Node is 0..n
But i am unable to read the checked items of the group.
Please help me out in solving my problem........Hi,
Use the following
for (int x=0; x< wdContext.nodeTest().size(); x++)
if( wdContext.nodeTest().isMultiSelected(x) )
// Selected Element
IWDNodeElement nodeElement = wdContext.nodeTest().getElementAt(x);
nodeElement.setAttributeValue("<Your Attribute> ", <Value>);
//Ex setting value for attribute called Name
nodeElement.setAttributeValue("Name", "Test");
Regards
Ayyapparaj -
Retrieving data from XML containing namespaces?
Hi,
I am using Yahoo Local Search Service which returns the XML
response. I want to retrieve data from the XML that I received. I
stuck at this point and unable to retrieve the response in to
datagrid. Does the namespaces in XML matter while retrieving data?
The response XML is as follows
<ResultSet xsi:schemaLocation="urn:yahoo:lcl
http://api.local.yahoo.com/LocalSearchService/V3/LocalSearchResponse.xsd"
totalResultsAvailable="224" totalResultsReturned="1"
firstResultPosition="1" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:lcl">
<ResultSetMapUrl>
http://maps.yahoo.com/broadband/?q1=San+Jose%2C+CA+95112&tt=starbucks&tp=1</Result SetMapUrl>
<Result id="21590724">
<Title>Starbucks</Title>
<Address>145 W Santa Clara St</Address>
<City>San Jose</City>
<State>CA</State>
<Phone>(408) 288-8803</Phone>
<Latitude>37.335236</Latitude>
<Longitude>-121.892765</Longitude>
<Rating>
<AverageRating>4</AverageRating>
<TotalRatings>3</TotalRatings>
<TotalReviews>2</TotalReviews>
<LastReviewDate>1198029377</LastReviewDate>
<LastReviewIntro>My previous review had incorrect
data. That was not true, I am sorry, I didn't know. As far as food
and drink goes, Starbucks is pretty good.</LastReviewIntro>
</Rating>
<Distance>0.96</Distance>
<Url>
http://local.yahoo.com/info-21590724-starbucks-san-jose</Url>
<ClickUrl>
http://local.yahoo.com/info-21590724-starbucks-san-jose</ClickUrl>
<MapUrl>
http://maps.yahoo.com/maps_result?q1=145+W+Santa+Clara+St+San+Jose+CA&gid1=21590724</M apUrl>
<BusinessUrl>
http://www.starbucks.com/</BusinessUrl>
<BusinessClickUrl>
http://www.starbucks.com/</BusinessClickUrl>
<Categories>
<Category id="96926219">Cafes</Category>
<Category id="96926236">Restaurants</Category>
<Category id="96926169">Coffee Houses</Category>
</Categories>
</Result>
</ResultSet>
The code that I am writing to get Title and Address is as
follows.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
backgroundAlpha="0" backgroundColor="#FFFFFF">
<mx:HTTPService
id="weatherService"
url="
http://local.yahooapis.com/LocalSearchService/V3/localSearch"
resultFormat="e4x"
result="resultHandler(event);"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var myResult:XML ;
private var temp:XMLNode;
private var list:ArrayCollection;
public function requestWeather():void {
weatherService.cancel();
var params:Object = new Object();
params.appid = "YahooDemo";
params.query = "starbucks";
params.zip = "95112";
params.results = "1"
weatherService.send(params);
public function resultHandler(event:ResultEvent):void {
myResult = XML( event.result);
temp = myResult.Result;
list = ArrayCollection(event.result);
]]>
</mx:Script>
<mx:Form width="400">
<mx:FormItem label="Get Local Data">
<mx:Button label="Get Data"
click="requestWeather();"/>
</mx:FormItem>
<mx:FormItem label="Address">
<mx:Text text="{myResult.Result.Address}"/>
</mx:FormItem>
<mx:FormItem label="Title">
<mx:Text text="{myResult.Result.Title}"/>
</mx:FormItem>
</mx:Form>
<mx:DataGrid
dataProvider="{myResult.Result}"
x="80" y="141" width="262" height="92"
id="shippingOptionsList" editable="false" enabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Title" dataField="Title"
/>
<mx:DataGridColumn headerText="Address"
dataField="Address" />
</mx:columns>
</mx:DataGrid>
<mx:Label text="Response as it is"/>
<mx:TextArea id="resultFld" text="{myResult}" width="400"
height="152"/>
</mx:Application>
Can somebody help me to find where I am going wrong?
Thank you
-PranayHi Pranay,
It looks like your problem is indeed to do with the XML
namespace being used.
Try adding this line after the import statements:
namespace yahoo = "urn:yahoo:lcl";
(This is the namespace URI defined in the returned XML)
The result handler should then look like this:
public function resultHandler(event:ResultEvent):void {
use namespace yahoo;
myResult = XML( event.result);
temp = myResult.Result;
list = ArrayCollection(event.result);
Maybe you are looking for
-
Since installing the 6.0.4 Safari update via the Mac App store, I have a host of problems: 1. Mail can no longer find "an associated app" when I click on a url in a mail message 2. The Share button (extension) in the Safari toolbar no longer works
-
Windows 8.1 got corrupted and had to restore from HP recovery disk
My computer running 8.1 started cycling between IE 11 and the Windows 8.1 home screen. It would not stop so I had to initiate a recovery from my built in HP recovery drive. When I did this it wiped out my OFFICE 2010 installation. How do I re-inst
-
How can I delete a self mounting shared partition in Keychain ?
Hi, When you accept to store username & password of a shared partition or folder in Keychain, later they are set to automount and log by themselves. How can I later delete those username & password from Keychain ? I tried but Keychain is not easy to
-
Solaris 10,oracle 10g question- can't connect with non-dba user
Hi I've installed the Oracle10g suite, enterprise edition ( 10.2.0.1). I've created a database called qa10g, which I can connect to as user 'oracle' once I export the ORACLE_SID and the ORACLE_HOME export ORACLE_HOME=/oracle/10g2 export ORACLE_SID=qa
-
Why is text2d and text3d so slow?
Recently i started timing operations in a game I am writting to find out where the bottlenecks were. Most of the delays I found made sense but I was suprised to find that writting text (2d or 3d) to the screen took an unacceptably large amout of time