Walking through a NotesViewNavigator - xpages

I posted part of this previously but thought I would start a new thread with a more complete code and problem. I am trying to walk through the categories in a NotesViewNavigator and this is the code that I am using. I have stripped it down to pretty much a minimum. The WFSUtils.sysOut just writes a message to the server console. The view has the "Do Not Display Empty categories" checked.
vw.setAutoUpdate(false);
var nav:NotesViewNavigator = vw.createViewNav();
nav.setEntryOptions(NotesViewNavigator.VN_ENTRYOPT_NOCOUNTDATA);
nav.setBufferMaxEntries(400);
nav.setMaxLevel(0);
var rtn:java.util.TreeMap=new java.util.TreeMap();
var entry:NotesViewEntry = nav.getFirst();
var thisCat:java.util.Vector = new java.util.Vector;
try{
while (entry != null){
WFSUtils.sysOut("Entry not null");
thisCat = entry.getColumnValues();
var thisCatString = thisCat.elementAt(0).toString()
WFSUtils.sysOut("thisCat = " + thisCatString);
rtn.put(thisCatString,"Nothing");
WFSUtils.sysOut("did put " + thisCatString)
var tEntry:NotesViewEntry = nav.getNextCategory();
entry.recycle();
entry = tEntry;
tEntry.recycle();
}
viewScope.put("vsCats", rtn.keySet());
}catch(e){
WFSUtils.sysOut("Error in getCategory " + e.toString())
}
When I run this code I get the following in the server console.
25/08/2014 12:55:42 PM HTTP JVM: Entry not null
25/08/2014 12:55:42 PM HTTP JVM: thisCat = Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 12:55:42 PM HTTP JVM: did put Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 12:55:42 PM HTTP JVM: Error in getCategory Method NotesViewNavigator.getNextCategory(lotus.domino.local.ViewEntry) not found, or illegal parameters
It fails at the getNextCategory(entry) that it is not found or illegal parameter. If I change it to just getNext(entry) the console log shows:
25/08/2014 01:06:48 PM HTTP JVM: Entry not null
25/08/2014 01:06:48 PM HTTP JVM: thisCat = Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 01:06:48 PM HTTP JVM: did put Approved~Bill Fox^WFS Automated Back end Process Example
25/08/2014 01:06:48 PM HTTP JVM: Entry not null
25/08/2014 01:06:48 PM HTTP JVM: Error in getCategory Exception occurred calling method NotesViewEntry.getColumnValues()
25/08/2014 01:06:48 PM HTTP JVM: null
So it would appear to me that the var entry is getting messed up somewhere along the line. Interesting is that the getFirst works and my code functions the way I would expect it but neither getNext nor getNextCategory seems to work. Am I missing something in my code or what the getNextCategory should be doing.

Delete the line
tEntry.recycle();
This recycle() destroys your entry as both entry and tEntry point to the same Notes object.
Delete the parameter from
... nav.getNextCategory();
Your code shown in question doesn't have a parameter but the error message and your comment tell you have.

Here is what I have ended up with. What I need to do is create a series of nested Reapeat controls that function much like native Notes Categories. So the top level category is bound to a viewScope "vsCat1", the next to "vsCat2" and the last to "vsCat3" This process could be extended to handle more levels but I generally try to keep the number of categories below that. For this example the three categories are Status, Originator and Process. I have then built three views called vwDocsByStatus, vwDocsByStatusOrig, and vwDocsByStatusOrigProcess. The first column in each view is categorized. The byStatus view is simply a categorized view by Status, the StatusOrig is Status + "~" + Originator and the third Status + "~" + Originator + "~" + Process.
The collection name for the first repeat is cat1, second cat2 and third cat3. My code below is a JavaScript function that I'm going to move to a JAVA Bean but the function would be the same. So to load "vsCat1" I would call setCategory("vwDocsByStatus",""), to load "vsCat2" I would call setCategory("vwDocsByStatusOrig", cat1) which would load vsCat2 with all of the categories under cat1. calling setCategory("vwDocsByStatusOrigProcess", cat1 + "~" + cat2) will load vsCat3 with all categories under the combination cat1 ~ cat2. The limitation is that there is no expand all type of action, but I have found that in most cases that is OK.
Then in the final repeat it is bound to the domino view vwDocsByStatusOrigProcess and a computed filter on column of cat1 + "~" + cat2 + "~" + cat3
Each repeat has an expand/collapse button that sets some viewScope variables to control visibility and calls setCategory with the appropriate view and cat values. Faster method is to just get the column values from a view but that does not take into account reader fields so the return might have some category values that the user is not allowed to see. My testing this far is that this is pretty fast.
Hope this helps someone, also if you can see how to improve it feel free to make suggestions
function setCategory(appView:String , cat:String){
/*Given a categorized view retrieve the a list of values and store that
* list in a viewScope variable "vsCat" + n where n = "1" if cat is null
* if cat contains one "~" n = 2 if cat conatins two "~" n = 3
*
*/
//get appDB and the view
try{
var vw:NotesView = appProps[sessionScope.ssApplication].appDB.getView(appView);
vw.setAutoUpdate(false);
var nav:NotesViewNavigator = vw.createViewNav();
nav.setEntryOptions(NotesViewNavigator.VN_ENTRYOPT_NOCOUNTDATA);
nav.setBufferMaxEntries(400);
nav.setMaxLevel(0);
}catch(e){
WFSUtils.sysOut("Error in setCategory - " + e.toString());
return "";
break;
}
try{
var rtn:java.util.TreeSet=new java.util.TreeSet();
var entry:NotesViewEntry = nav.getFirst();
if (cat.indexOf("~") > 0) {
n = 3;
}else if (cat == null || cat == ""){
n = 1;
}else {
n = 2;
}
var catArray:Array = cat.split("~");
var thisCat:Array = new Array;
while (entry != null && !entry.isTotal()) {
thisCat = entry.getColumnValues();
var temp:String = thisCat[0].toString();
thisCat = temp.split("~");
if (typeof thisCat === "string"){
thisCat = [thisCat];
}
switch (n){
case 1 :
if (!rtn.contains(thisCat[0])){
rtn.add(thisCat[0]);
}
break;
case 2 :
if (cat == thisCat[0]){
if (thisCat[1] != null){
if (!rtn.contains(thisCat[1]))rtn.add(thisCat[1]);
}
}
break;
case 3 :
if (cat == thisCat[0] + "~" + thisCat[1]){
if (thisCat[2] != null){
if (!rtn.contains(thisCat[2]))rtn.add(thisCat[2]);
}
}
break
}
var tmpentry:NotesViewEntry = nav.getNextCategory();
entry.recycle();
entry = tmpentry;
}// end while
// set the viewScope variable
vw.setAutoUpdate(true);
viewScope.put("vsCat" + n.toString(),rtn);
}catch(e) {
WFSUtils.sysOut("Error in setCategory - " + e.toString());
}finally{
try{
WFSUtils.recycleObjects([nav, entry, tmpEntry]);
}catch (e) {
//do nothing caused by undefined object shouldn't happen
}
}
}

Related

Netsuite Email Merge Error (SSS_MERGER_ERROR_OCCURRED)

I'm creating a Scheduled SuiteScript in Netsuite that uses the 1.0 version of the API. The goal is to have the script run once per day to send our first time customers an email with their name (or company name) and other pre-formatted content using a Scriptable Email Template.
Once it is up and running, we are planning to extend it with additional functionality, but this is the base that we would like to have running before adding additional code.
The error message is:
SSS_MERGER_ERROR_OCCURRED - Merger error occurred: Unexpected error encountered during merging.
Everything goes smooth up until actually using .merge(). I've added the code below:
function thankyouletter() {
var searchresults = nlapiSearchRecord(null, 'customsearch127'); // minus: , filters
if (searchresults == null) {
response.write('Var searchresults is null.');
return;
} else {
nlapiLogExecution('DEBUG', 'START - Found search results', 'Starting iteration');
for (var i = 0; searchresults != null && i < searchresults.length; i++) {
var searchresult = searchresults[i];
var searchCols = searchresult.getAllColumns();
var internalid = searchresult.getId(); // Will be used after testing is finished
var emailMerger = nlapiCreateEmailMerger(38);
emailMerger.setEntity('customer', 24886); // Set for Testing
var mergeResult = emailMerger.merge(); // Fails and errors here
var emailSubject = mergeResult.getSubject();
var emailBody = mergeResult.getBody();
nlapiSendEmail(nlapiGetUser(), customerid, emailSubject, emailBody, null, null, null, null);
nlapiLogExecution('DEBUG', 'Merge Troubleshooting', 'Just after SendEmail');
}
}
var usageRemaining = context.getRemainingUsage();
nlapiLogExecution('DEBUG', 'usage left => ' + usageRemaining);
nlapiLogExecution('DEBUG', 'Script Finished.', 'Mission Complete');
}
I've removed some of the nlapiLogExecution lines for readability. If anything is confusing or additional info is needed, please let me know and I'll add/fix it.
I've dug through piles of Netsuite's documentation, SuiteAnswers, and web searches trying to find the solution, but the error message is pretty vague.
Any help is greatly appreciated! Thank you.
After further research, I found that the Freemarker Template had a syntax error, and that was causing the error.

RangeError Maximum call stack size exceeded on Creating Sales Order

We are developing a client script that will auto update the rate or unit price (*this is a custom column), but it throws an error and I think its because if we change the rate it will auto update the unit price and after the unit price has been updated it will update the rate also, so on and so on until it reach the maximum call stack, We are looking for any workaround for this not to happen, please see my code below. Thanks
function fieldChanged(type, name, linenum)
{
var context = nlapiGetContext();
var user = context.getUser();
var execution = context.getExecutionContext();
try {
switch (name) {
case "custcol_cqwst_po_uprice":
if (execution == "userinterface") {
var qty = nlapiGetCurrentLineItemValue('item', 'quantity');
var taxCode = nlapiGetCurrentLineItemValue('item', 'taxcode');
if (!isNullOrEmpty(taxCode) && !isNullOrEmpty(qty)) {
var taxRate = nlapiGetCurrentLineItemValue('item', 'taxrate1');
var unitprice = nlapiGetCurrentLineItemValue('item', 'custcol_cqwst_po_uprice');
var vatRate = 1 + ((taxRate.replace('%', '')) / 100);
var unitRate = unitprice / vatRate;
nlapiSetCurrentLineItemValue('item', 'rate', unitRate);
}
}
break;
//case "taxcode":
//break;
case "rate":
if (execution == "userinterface") {
var qty = nlapiGetCurrentLineItemValue('item', 'quantity');
var taxCode = nlapiGetCurrentLineItemValue('item', 'taxcode');
if (!isNullOrEmpty(taxCode) && !isNullOrEmpty(qty)) {
var taxRate = nlapiGetCurrentLineItemValue('item', 'taxrate1');
var rate = nlapiGetCurrentLineItemValue('item', 'rate');
var vatRate = 1 + ((taxRate.replace('%', '')) / 100);
var unitPrice = rate * vatRate;
nlapiSetCurrentLineItemValue('item', 'custcol_cqwst_po_uprice', unitPrice);
nlapiLogExecution('debug', "Rate Value", "Rate: " + rate + " Vat Rate: " + vatRate + " Unit Price: " + unitPrice + " Execution: " + execution);
}
}
break;
}
}
catch (ex) {
alert("A scripting problem occurred during the onFieldChange event please inform an administrator quoting the following error: " + ((ex instanceof nlobjError) ? ex.getCode() + '\n' + ex.getDetails() : ex.toString()));
}
}
nlapiSetCurrentLineItemValues() has a fourth paramater called firefieldchanged which can be set to false to prevent exactly this issue
Using the Fire Field Changed Parameter
When creating scripts that provide the ability to watch a field for a
change, and then write back to the field that changed, a risk of
creating an infinite loop exists as follows:
The Client script watches for fieldA to change.
fieldA changes.
The script writes to fieldA, causing the Field Changed event to fire,
returning the code to step 2, and this loop repeats indefinitely.
To prevent this looping behavior, you can set the optional
firefieldchanged parameter in your client scripts.
The firefieldchanged parameter is available for all write functions.
If set to true, the parameter causes any field changed events to fire
as normal. This is the default setting. If set to false, field changed
events are NOT fired.
https://system.netsuite.com/app/help/helpcenter.nl?fid=section_N3042487.html#bridgehead_N3050839

Validate In-Line Edits in Netsuite

I need to validate inline editing in NetSuite.
I already have a Client Script in place that works great when editing the record normally.
I tried adding a User Event script that on the before save function that validates the record, but it appears this is ignored with inline editing.
Has anybody ran into this before?
Any insight you can provide would be helpful. Thanks!
Edits:
The relevant code from the UE script:
function beforeSubmit(type){
if (type == "create" || type == "edit" || type == "xedit") {
var status = nlapiGetContext().getSetting("SCRIPT", "...");
var amount = Number(nlapiGetContext().getSetting("SCRIPT", "..."));
var nr = nlapiGetNewRecord();
var entitystatus = nr.getFieldValue("entitystatus");
var projectedtotal = Number(nr.getFieldValue("projectedtotal"));
if (entitystatus == status && projectedtotal >= amount) {
var statusText = nr.getFieldText("entitystatus");
var message = "ERROR...";
throw nlapiCreateError("...", message, true);
}
}
}
This applies to the opportunity record.
The field being validated is Projected Total with id projectedtotal.
My mistake, I misunderstood how xedit handled nlapiGetNewRecord(). Calling nlapiGetNewRecord when in xedit only returns the edited fields, not the entire record. Thus, the if statement was never true in xedit mode, because either the amount or the status would be null (it was very unlikely the user would edit both at the same time, and validation relies on both these fields' values).
I edited the code to lookup the field value if it is not present in the new record. Now everything works as expected!
Thanks everyone for the help!
For reference, the corrected code is below.
function beforeSubmit(type){
if (type == "create" || type == "edit" || type == "xedit") {
var status = nlapiGetContext().getSetting("SCRIPT", "...");
var amount = Number(nlapiGetContext().getSetting("SCRIPT", "..."));
var nr = nlapiGetNewRecord();
//Attempt to get values normally
var entitystatus = nr.getFieldValue("entitystatus");
var projectedtotal = Number(nr.getFieldValue("projectedtotal"));
var id = nr.getId();
//If values were null, it's likely they were not edited and
//thus not present in nr. Look them up.
if(!entitystatus){
entitystatus = nlapiLookupField("opportunity", id, "entitystatus");
}
if(!projectedtotal){
projectedtotal = Number(nlapiLookupField("opportunity", id, "projectedtotal"));
}
if (entitystatus == status && projectedtotal >= amount) {
var message = "ERROR...";
throw nlapiCreateError("101", message, true);
}
}
}
In your user event are you checking the value of the type parameter. For inline editing, the value of the type is 'xedit'.

How to create Purchase Order in Netsuite with ScriptSuite?

I am new to Netsuite and I was asked to perform a script that was launched from an application programmed in java. The script with a function to generate a Purchase Order in Netsuite and other function to list the Purchase Order created earlier. It turns out that for this I am using the api SuiteScript but when creating the Purchase Order run the java application and launches the script but it gives the following error:
Aug 03, 2015 2:49:00 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: {"error": {"code": "user_error", "message": "Please enter value (s) for: Vendor"}}
Javascript function to create is:
function CreatePurchase_Orders(datain){
var output = '';
nlapiLogExecution('DEBUG','createRecord','ingreso la consulta' ) ;
nlapiLogExecution('DEBUG','createRecord', 'Ingresa: '+ datain);
//var msg = validateTimeBills(datain);
var msg = null;
if (msg){
var err = new Object();
err.status = "failed";
err.message= msg;
return err;
}
var Purchase_Orders = datain.Purchase_Order;
nlapiLogExecution('DEBUG','createRecord', 'obtuvo el objeto: '+ Purchase_Orders);
for (var Purchase_Orderobject in Purchase_Orders){
var Purchase_Order = Purchase_Orders[Purchase_Orderobject];
var transdate = Purchase_Order.Transdate;
var Form = Purchase_Order.Form;
var Vendor = Purchase_Order.Vendor;
var Currency = Purchase_Order.Currency;
var Item = Purchase_Order.Item;
nlapiLogExecution('DEBUG','campos','transdate: '+ transdate+'/Form: '+Form + ' /Vendor: ' + Vendor + ' /Currency: ' + Currency
+ ' /Item: ' + Item);
var Purchase_Order = nlapiCreateRecord('purchaseorder');
var nlobjAssistant = nlapiCreateAssistant ( 'asistente' , false ) ;
var Purchase_Orderid = 1;//nlapiSubmitRecord( Purchase_Order , true, true);
if(Purchase_Order){
nlapiLogExecution('DEBUG', 'Purchase_Order ' + Purchase_Orderid + ' successfully created', '');
nlapiLogExecution('DEBUG', 'createRecord', 'creo el record');
}
Purchase_Order.setFieldValue('transdate', transdate);
Purchase_Order.setFieldValue('inpt_customform1', Form);
Purchase_Order.setFieldValue('vendor', Vendor);
Purchase_Order.setFieldValue('inpt_currency7', Currency);
Purchase_Order.setFieldValue('inpt_item', Item);
Purchase_Order.setFieldText('quantity_formattedValue', '1');
Purchase_Order.setFieldText('rate_formattedValue', '1');
Purchase_Order.setFieldText('amount_formattedValue', '1');
Purchase_Order.setFieldText('inpt_taxcode', 'VAT_MX:UNDEF_MX');
Purchase_Order.setFieldText('grossamt_formattedValue', '1');
Purchase_Order.setFieldText('tax1amt_formattedValue', '0');
Purchase_Order.setFieldText('expectedreceiptdate', '24/6/2015');
//var Purchase_Orderid = 1;//nlapiSubmitRecord( Purchase_Order , true, true);
var submitRecord = nlapiSubmitRecord(Purchase_Order);//,true);
nlapiLogExecution('DEBUG', 'submirRecord ' + submitRecord);
}
var mesg = new Object();
mesg.status = "OK";
mesg.message= nlobjAssistant.getAllFields();
return mesg;
}
And the function code in Java is:
WebClient client = new WebClient(BrowserVersion.FIREFOX_31);
client.getOptions().setJavaScriptEnabled(false);
client.getOptions().setThrowExceptionOnScriptError(false);
WebRequest requestSettings = new WebRequest(new URL(url),HttpMethod.POST);
requestSettings.setAdditionalHeader("Host", "rest.na1.netsuite.com");
requestSettings.setAdditionalHeader("User-Agent", "SuiteScript-Call");
requestSettings.setAdditionalHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
requestSettings.setAdditionalHeader("Accept-Language", " es-cl,es;q=0.8,en-us;q=0.5,en;q=0.3");
requestSettings.setAdditionalHeader("Accept-Encoding", "gzip, deflate");
requestSettings.setAdditionalHeader("Content-Type", "application/json");
requestSettings.setAdditionalHeader("Pragma", "no-cache");
requestSettings.setAdditionalHeader("Cache-Control", "no-cache");
requestSettings.setAdditionalHeader("Referer", "http://localhost:8084");
requestSettings.setAdditionalHeader("Cookie", "");
requestSettings.setAdditionalHeader("Connection", "keep-alive");
requestSettings.setAdditionalHeader("Authorization", "NLAuth nlauth_account=" + account + ", nlauth_email=" + mail + ", nlauth_signature=" + pass + ", nlauth_role=" + role + "");
Gson gson = new Gson();
//objeto llenado estaticamente de forma momentanea, se debe leer desde archivo externo
Purchase_Order purchaseOrder = new Purchase_Order("25/06/2015","formTest","vendorTest","CurrencyTest","itemTest");
String cuerpo = gson.toJson(purchaseOrder);
System.out.println(cuerpo);
// Set the request parameters
requestSettings.setRequestBody(cuerpo);
Page page = client.getPage(requestSettings);
WebResponse response = page.getWebResponse();
String json = response.getContentAsString();
System.out.println(json);
With this javascript function you should create me a record Purchase Order but I can not find the error and the solution if someone could please help me I would appreciate it a lot.
PS: if you have to create a customized form could tell me how?
thanks!
Here are some points :
As your error message says Please enter value (s) for: Vendor, you're missing the value for vendor field, which is mandatory. In your piece of code you're passing wrong internalid value for vendor. You should use entity instead of vendor
Purchase_Order.setFieldValue('entity', Vendor); // where vendor is the internal id of the vendor record
For setting custom form you can use
Purchase_Order.setFieldValue('customform', Form); // where Form is the id of the custom form
I also noticed that you're setting some values in purchase order which I suspect are to be a kind of custom one. If that is the case, then your custom field internal id should be prefixed with custbody.
For all the standard fields internal id you can refer to the Suite script Records Browser.

XPages - using POI 4 XPages and it errors on $ symbol exporting to Word/PDF

I am using the splendid POI4Xpages add-on for my Xpage. It does very well mapping the web page to the Word or PDF, but I have noticed it bombs when there is a dollar sign ($) within any of the fields on the Xpage/Notes document.
Right now, my workaround for users is to substitute USD in place of the $ symbol, but my users and I would like it to handle the $.
I enclosed the error dump below.
Suggestions for where to begin (and end) are much appreciated. Thank you in advance.
POI 4 XPages -> ERROR
--------------------------------------------------------------
Error : Error during Documentgeneration
POI LIB : 1.2.6.201312211419
StackTrace:
java.lang.IllegalArgumentException: Illegal group reference
at java.util.regex.Matcher.appendReplacement(Matcher.java:724)
at java.util.regex.Matcher.replaceAll(Matcher.java:824)
at java.lang.String.replaceAll(String.java:1591)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.processBookmarks2Run(DocumentProcessor.java:129)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.processBookmarks 2Paragraph(DocumentProcessor.java:118)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.processBookmarks 2Table(DocumentProcessor.java:110)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.processBookmarks 2Document(DocumentProcessor.java:84)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.processDocument( DocumentProcessor.java:193)
at biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.generateNewFile( DocumentProcessor.java:143)
at biz.webgate.dominoext.poi.component.containers.UIDocument.processAjaxRequest( UIDocument.java:208)
at biz.webgate.dominoext.poi.component.actions.DocumentGenerationServerAction.in voke(DocumentGenerationServerAction.java:48)
at com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.j ava:60)
at javax.faces.component.UICommand.broadcast(UICommand.java:324)
at com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:366)
at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
at com.ibm.xsp.extlib.component.layout.UIVarPublisherBase.broadcast(UIVarPublish erBase.java:185)
at com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1535)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase .java:94)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
at com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:2 56)
at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:228)
at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103 )
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(Compone ntModule.java:576)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentMo dule.java:1335)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invoke Servlet(ComponentModule.java:853)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doServ ice(ComponentModule.java:796)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentMo dule.java:565)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule .java:1319)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:66 2)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironme nt.java:357)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment .java:313)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.jav a:272)
We had this same issue and basically did a hack like below to prefix a $ if we found a decimal. Hope this helps out.
function process(xwpfdocument){
try{
// Get POI Document
var x = xwpfdocument;
var tables:java.util.Iterator = x.getTablesIterator();
while(tables.hasNext()){
var t = tables.next();
var numRows = t.getNumberOfRows();
// Loop Through All Rows
if(numRows>0){
for(var row=0; row<numRows; row++){
var cellList:java.util.List = t.getRow(row).getTableCells();
var numCells = cellList.size();
// Loop through all Cells
for(var cell=0; cell<numCells; cell++){
var c = cellList.get(cell);
var paragraphs:java.util.List = c.getParagraphs();
// Loop through all Paragraphs
for(var para=0; para<paragraphs.size();para++){
var p = paragraphs.get(para);
var runs:java.util.List = p.getRuns();
// Loop through all Runs
for(var r=0;r<runs.size();r++){
var run = runs.get(r);
var txt=run.getText(0);
if(txt.indexOf("<NL>")>-1){
var newRun = p.createRun();
var newTxt = txt.split("<NL>");
for(var n=0; n<newTxt.length; n++){
// Add New Runs with Breaks
var prefix = "";
if(newTxt[n].indexOf(".")>-1){
prefix = "$";
}
newRun.setText(#Text(prefix+newTxt[n]));
newRun.addBreak();
}
//Delete old run
//p.removeRun(0);
} else { //added for cases with only one account
var newRun = p.createRun();
var prefix = "";
if(txt.indexOf("%")>-1) { //added so SS002, SS003, and SS004 keep the %, added from the Letter.getBookmarkAPR function, rather than prepending a $
//nothing required
} else if(txt.indexOf(".")>-1){
prefix = "$";
}
newRun.setText(#Text(prefix+txt));
}
//Delete old run
p.removeRun(0);
}
}
}
}
}
}
} catch(e){
// Write to Log
system.out.println(e.getLocalizedMessage());
}
//Done
return;
}
Christian Güdemann posted a new build that addressed the $ character in the middle of a text field issue.
http://www.webgate.biz/ftp/openntf/POI4XPages/snapshot/biz.webgate.dominoext.poi-1.3.0-SNAPSHOT.zip
Btw there is a mailinglist in place to be informed about development builds:
http://mm.wgcdev.ch/mailman/listinfo
Thank you for your help, Dwain and Christian!

Resources