select.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: ps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2011
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  9. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  10. // This javascript file accepts a name and 2 values - the first value is the string representation, the second is the XML encoded representation.
  11. // name, stringValue, xmlencodedStringValue [, name , stringValue, xmlencodedStringValue [...]]
  12. // This javascript file contains the following functions:
  13. // setNameArray - loads the arrays with the appropriate information.
  14. // getNameStringValue - returns the stringValue.
  15. // getNameXMLValue - returns the xmlencodeStringValue.
  16. // Declare name holding array.
  17. var itemReturnArray = new Array();
  18. function setItemReturnArray()
  19. {
  20. var args = arguments.length;
  21. itm = arguments[0];
  22. if(itemReturnArray[itm]==null)
  23. {
  24. itemReturnArray[itm] = new Array;
  25. }
  26. for(i=1; i < args ;i++)
  27. {
  28. nm = arguments[i];
  29. if(itemReturnArray[itm][nm]==null)
  30. {
  31. itemReturnArray[itm][nm] = new Array(); // create the array to store the values
  32. }
  33. itemReturnArray[itm][nm][0] = arguments[++i]; // store stringValue
  34. itemReturnArray[itm][nm][1] = arguments[++i]; // store xmlencodedStringValue
  35. }
  36. }
  37. function getReturnStringValue(itm,nm)
  38. {
  39. var err = itemReturnArray[itm]==null ? 'true' : itemReturnArray[itm][nm]==null ? 'true' : 'false';
  40. return err=='false' ? itemReturnArray[itm][nm][0] : ''; // return StringValue
  41. }
  42. function getReturnXMLValue(itm,nm)
  43. {
  44. var err = itemReturnArray[itm]==null ? 'true' : itemReturnArray[itm][nm]==null ? 'true' : 'false';
  45. return err=='false' ? itemReturnArray[itm][nm][1] : ''; // return xmlencodedStringValue
  46. }