This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 26, 2012, 8:59 AM
93 Posts
topic has been resolvedResolved

Undefined? HELP!

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: dblookup,undefined,xpages
  • Replies: 4
 Hi guys,
 
I have the following code on an XPage....
 
 <xc:ccCalData xp:key="calData" lookupViewDataCol="3"
lookupViewName="luMonthView" lookupViewUNIDCol="4"
NoTooltipText="undefined" lookupAppType="5"
lookupViewToolTipCol="6">
</xc:ccCalData>
 
Then in custom control on this XPage I have a facet, doing the following code: 
 
var luKey = luDay + "/" + luMonth + "/" + sessionScope.get("dispDate").getFullYear();
writeToLog("luKey: " + luKey);
var viewName = compositeData.lookupViewName;
var rawData = DbLookupArray(viewName,luKey,compositeData.lookupViewDataCol);
var docData = DbLookupArray(viewName,luKey,compositeData.lookupViewUNIDCol);
var toolTipData = DbLookupArray(viewName,luKey,compositeData.lookupViewToolTipCol);
var getAppType = DbLookupArray(viewName,luKey,compositeData.lookupAppType);
 
lukey, viewnName, rawData, docData and toolTipData all return values, however getAppType is returning 'Undefined' and I dont know why!
 
The lookupAppType is definitely in column 5 of my view, and has values when I view in the client - so I am not sure why all other values in the view are getting picked up, but this one is not?
 
The DBLookupArray code that it calls is: 
 
function DbLookupArray(viewname, k, field) {
if (requestScope.get("dblookuparray-"+viewname+"-"+k+"-"+field)) {
/*writeToLog("ONE: " + viewname+"-"+k+"-"+field);*/
return requestScope.get("dblookuparray-"+viewname+"-"+k+"-"+field);
}
var r = @DbLookup("", viewname, k, field);
if (r && typeof r == "string") r = new Array(r);
if (r) requestScope.put("dblookuparray-"+viewname+"-"+k+"-"+field, r);
/*writeToLog("TWO: " + r);*/
return r;
}
 
Any idea's greatly appreciated as I am completely stuck!
 
Thanks 
 
 
 
 
Mar 26, 2012, 11:03 AM
17 Posts
Re: Undefined? HELP!
Just guessing: the parameter in DbLookupArray is used as text (=field name), not as a number (=column number)?
I think that the property 'lookupAppType' has got the wrong type (string) in the property definition (instead of int).
 
BTW: I am afraid typeof r in this piece of code
if (r && typeof r == "string") r = new Array(r); 
probably never returns 'string'.
 
 
Mar 26, 2012, 12:28 PM
93 Posts
Re: Undefined? HELP!
 Hi Rick,
 
The appType field does contain an number (int) however I am storing it as a text field, and also using @Text in the view column display formula so the value should always be picked up as a string?
 
Interestingly, If I change the column value of the tooltip to be the apptype, the tooltip on the web works, and displays the apptype values (either a 1 or a 3) however it simply wont work with a new column, no matter what position in the view I put it! 
Mar 26, 2012, 12:55 PM
17 Posts
Re: Undefined? HELP!
Hi Chris,
I mean property type in your custom component (Custom Control - Property Definition tab), not the type of values in this column in your view.
The tooltip property probably has got the correct (int) type - that's why it works.
Apr 10, 2012, 3:12 PM
93 Posts
Re: Undefined? HELP!
 Hi Rick,
 
You were correct, I was passing the number in as a string instead of an int. 
 
Thanks very much for your help! 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal