on 2010 Jul 28 3:29 AM
Hey guys
I ma using Xmii 12.0 - mobving to 12
I am trying to do a simple query on a web page and grab the result data in javascript
I dont understand what i am doing wrong.
I have the wollijg applet
<APPLET NAME="cmdPeriod" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="1" HEIGHT="1" MAYSCRIPT>
<PARAM NAME="QueryTemplate" VALUE="NIW_MES_Data_Extract/30_Reporting/qry_Period_Get">
</APPLET>
And the following javascript :
document.cmdPeriod.getQueryObject().setParam(1,PeriodDate);
document.cmdPeriod.getQueryObject().setParam(2,PeriodTypeID);
document.cmdPeriod.getQueryObject().setParam(3,siteCode);
document.cmdPeriod.executeCommand();
showDebug(document.cmdPeriod.getValue(1, 3));
I know that the query with those parameters returns a single row.
so why do I always get NOTHING back when i Call getValue()
Do i need a Display template for my iCommand ???
If so, how/where do i create it ???
Request clarification before answering.
Hello,
The code shown by you is correct,
<APPLET NAME="cmdPeriod" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="1" HEIGHT="1" MAYSCRIPT>
<PARAM NAME="QueryTemplate" VALUE="NIW_MES_Data_Extract/30_Reporting/qry_Period_Get">
</APPLET>
document.cmdPeriod.getQueryObject().setParam(1,PeriodDate);
document.cmdPeriod.getQueryObject().setParam(2,PeriodTypeID);
document.cmdPeriod.getQueryObject().setParam(3,siteCode);
document.cmdPeriod.executeCommand();
showDebug(document.cmdPeriod.getValue(1, 3));
But if you are trying to return output from an iCommand Applet then in Query Template instead of using Command mode use FixedQuery Mode
Hope this helps!!
Another thing, I also noticed that you said
showDebug(document.cmdPeriod.getValue(1, 3));
I know that the query with those parameters returns a single row.
so why do I always get NOTHING back when i Call getValue()
You are getting only 1 Row and you are referring to third row because getValue(1,3) represents Column 1 and Row 3 not the other way
Here's the syntax of getValue
String getValue(int ColID, int RowID)Instead your getValue should be getValue(3,1) this will fetch you data from 3rd column of 1st row.
Regards,
Adarsh
Edited by: Adarsh Sidnoor on Jul 28, 2010 1:08 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another trick to use when debugging, especially since you can't see the results of the iCommand when it contains a dataset is to use either:
document.cmdPeriod.showDetail();
or
document.cmdPeriod.showXMLDetail();
after the executeCommand is called (also a good practice to follow as shown in the best practice guide is to wrap the executecommand inside an if statement so you can capture and alert any errors produced by the query).
This is common to all applets, and should give you the same thing as you would normally get from the right-click...data details output (grid/chart/etc).
Thanks for the feedback guys ...
you wouldnt believe how simple the answer is.
I assumed that getValue function accepted row and column as its parameters which it does
i.e.
getValue(row,column) is INCORRECT
getValue(column,row) is CORRECT
does anyone know of any documentation on web scripting?
A link to the "best practice guide" would be handy if you have one
http://help.sap.com/saphelp_xmii120/helpdata/en/44/d91ad2d06f3ee2e10000000a114a6b/frameset.htm
The BP guide link can be found at the top of the forum in one of the sticky threads.
Hi,
Try to refresh the table or grid from which you are trying to pick the value and then use the method getValue()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.