Menu
  • HOME
  • TAGS

Forcing Computed Fields on a Document to Recalculate using SSJS

Tag: xpages,lotus-notes,computed-field

Is there a way to force a documents computed fields to recalculate from within an Xpage, without saving the document?

I have a subform on a Notes database with many computed fields, these contain some complex calculations involving time range calculations. The database is used as both a web and client application. For the custom control containing the fields I don't want to have to recreate all the calculations, so have a computed text value bound to the computed form on the document.

On the subform as you tab through entering the information the computed fields are recalculated. On the custom control I have a refresh button which saves the datasource and does a partial refresh of the data entry section, but this can cause some errors or document save conflicts.

I will recreate the calculations if need be, but I just wondered if there is a slicker way of achieving this before I start that process?

Best How To :

DominoDocumentData object has computeDocument() and doComputeDocument() methods. I'm not sure what they do. If you look at the class for your XPage / Custom Control under Local\xsp you can see them. Using the variable name for your datasource, e.g. document1, you will be able to get a hold of the DominoDocumentData object and case it to that class.

XPages: How to disable a button in a repeat control

javascript,xpages

Get the client side id with #{id:ActionBtn} and use it to get the button element to disable it: document.getElementById("#{id:ActionBtn}").disabled=true or to hide it after clicking document.getElementById("#{id:ActionBtn}").style.visibility='hidden' or document.getElementById("#{id:ActionBtn}").style.display='none' Example: <xp:repeat id="repeat1" rows="30"> <xp:this.value><![CDATA[#{javascript:[1,2,3,4]}]]></xp:this.value> <xp:button value="Label" id="ActionBtn"> <xp:eventHandler event="onclick"...

dojo.exists fails with IE11

javascript,dojo,xpages,internet-explorer-11,lotus-domino

Using dojo.exists for this isn't very appropriate, given that btnUpload is technically just a DOM ID, and not an actual object in the global scope. if (document.getElementById('btnUpload')) would seem to be far more appropriate in this case. When a global reference is encountered that doesn't match an actual global variable,...

How do I get the search menu to appear in the Xpages perspective in Domino Designer

xpages,domino-designer-eclipse

An alternative solution is to modify your application navigator for your Domino Designer perspective to include faces-config (in Preferences): ...

XPages: I need a full stacktrace

java,xpages

I think that e.printStackTrace(); gives you the whole thing. You use this line stand alone. It can't be part of a System.out.println, which I tried to do once, although that is what it does essentially. You would put this in your catch block. So the entire code would be: catch...

font-awesome with xpages does not take effect even after loading

xpages,font-awesome

The actual reason behind the above issue was the path which I was given in ".css" files to the font files,which are located in font directory. Now from the beginning we can see,the ".theme" file code in which resource path is "font-awesome-4.2.0/font-awesome-4.2.0/css/font-awesome.min.css" <resource rendered="#{javascript:context.getProperty('xsp.resources.aggregate').equals('true')}"> <content-type>text/css</content-type> <href>font-awesome-4.2.0/font-awesome-4.2.0/css/font-awesome.min.css</href> according to...

Default Scope of XPages Data Sources (xp:dominoDocument and xp:dominoView)

xpages

A data source object will always sit in the request scope. What you are changing is the behaviour of the data container of the datasource, which is in the view scope by default. When using the Debug Toolbar, you can see the behaviour: Even if you set the data source's...

Domino Xpages with Reverse Proxy

proxy,xpages,lotus-domino

When using a reverse proxy, we recommend keeping the original URL unchanged. Because many redirects, Ajax requests, cookie are closely related to URL, if the URL changes, almost must go to modify the code. This problem is especially serious in Domino, because in a lot of Javascript code that will...

How to get an xsp value from URL link using Java

java,javascript,xpages

The best way to get SSJS variable names via Java is resolveVariable. This should work: XSPContext context = (XSPContext) ExtLibUtil.resolveVariable(FacesContext.getCurrentInstance(), "context"); String pageName = context.getUrl().getSiteRelativeAddress(context).toString(); (Updated with correct syntax for second line, thanks Knut)...

How to add external third party jar in Notes Xpages application?

java,jar,xpages,lotus-notes

If you add a JAR to your project by importing it into /Code/JARs, it should be added so as to be accessible by your build path(2,3). The same is true of your /WebContent/WEB-INF/lib, but that may not be automatically defined in your version of DDE; for example, Domino Designer 9...

XPages: How to acces an application scope bean from a session scope bean

jsf,xpages

The VariableResolver goes through all implicit variables (e.g. session, database) as well as scoped variables (e.g. applicationScope.myVar). Your bean is also accessed from SSJS via the VariableResolver. So you can use: ExtLibUtil.resolveVariable(FacesContext.getCurrentInstance(), "myAppScopeBean"); ...

How to store a list of dates in a multi-value field using SSJS?

xpages

TL;DR: The concept should be almost identical to a multi-value Field of Strings, your Date(/Time) values need to be valid NotesDateTime values properly stored. A Notes field can have multiple Date/Time values; you can see this in the Form, selecting a field of type Date/Time and checking "Allow multiple values"....

Date fields and BootStrap Extention Lib

xpages,xpages-extlib

I've copied your code and tested it with version 11 of the Extension Library and the built-in Bootstrap3.2.0 theme. I've changed the <form class="form-horizontal"> to a <div class="form-horizontal">. After that it looked Ok: Von und Bis were rendered just as the other labels. A <form> is always created by the...

xPages countdown timer

javascript,xpages

Put the CSJS code into onClientLoad event. After changing some things it works now: <?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core"> <xp:eventHandler event="onClientLoad" submit="false"> <xp:this.script><![CDATA[ function startTimer(duration, display) { var timer = duration; setInterval(function () { if (--timer <= 0) { window.location="http://www.google.de"; } var minutes = parseInt(timer / 60, 10); var seconds...

Update sql database using Lotusscript

sql,lotus-notes,lotus-domino,lotusscript,lotus

I tried it with the sql query UPDATE and it's working now : Option Public Option Declare UseLSX "*LSXODBC" Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim dbcontacts As NotesDatabase Dim doc As NotesDocument Dim DocContact As NotesDocument Dim CandidatView As NotesView Dim ContactView As NotesView...

Xpages Open new Database in Same Tab/Windows in XPiNC

xpages

I would create an additional database which contains the XPages code from all databases and uses the current Notes databases as data containers only. This way you have all navigation and all XPages code at one place. And your code is separated from data which is always good. You would...

When do I know that my project has been really built?

xpages

You can change the CTRL+B key from "Build All" to "Build Project". Open Preferences General/Keys, search for "Build" and remove CTRL+B for "Build All" and set it for "Build Project": ...

iOS favicons (Add to Home Screen)

xpages,bootstrap,xpages-extlib

Use headTag on your layout custom control. Here's an example: <xp:this.resources> <xp:headTag tagName="link"> <xp:this.attributes> <xp:parameter name="rel" value="apple-touch-icon"></xp:parameter> <xp:parameter name="size" value="60x60"></xp:parameter> <xp:parameter name="href" value="icon-60x60.png"></xp:parameter> </xp:this.attributes> </xp:headTag> </xp:this.resources> ...

XPages Runtime optimized Javascript and CSS resources is not working

javascript,css,runtime,xpages,aggregator

The problem appears to be the DSAPI filter used with Siteminder. When the filter (DominoWebAgent.dll) file is removed, the problem goes away. As we are going away from Siteminder soon, we will just wait to use the aggregation tool. Thank you to each person who offered their thoughts on this...

Need to extract attachments from Outlook (.msg) attachment via Lotus Notes

outlook,lotus-notes,attachment,lotusscript

Save the attachment using Attachment.SaveAsFile, then open the MSG file using Namespace.OpenSharedItem.

XPages: Login not working?

login,xpages

Agree with Paul... You could try: http://yourserver.com/names.nsf?open&login to check if your login is correct - disregarding any issues with your XPage. Next, have a look at your server console to see if anything is written there to indicate a problem. If so it is easiest to use something like the...

Unitegallery not working with repeat control

xpages,repeat

This should work: <xp:scriptBlock id="scriptBlock2"> <xp:this.value><![CDATA[ $(document).ready( function() { $("#gallery").unitegallery({ gallery_theme: "carousel", tile_width: 60, //tile width tile_height: 60, //tile height }); } ); ]]></xp:this.value> </xp:scriptBlock> <xp:panel> <div id="gallery" style="display:none;"> <xp:repeat rows="100" var="pictureData" value="#{view4}" removeRepeat="true"> <xp:image url="#{javascript:pictureData.getColumnValue("bigPicture")}">...

Best way to handle multi-valued fields as a view/grid

dojo,xpages

This TableWalker may provide what you want http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23 It was created when XPages was all very new, so it's SSJS rather than Java. But if you're comfortable wiith Java, converting it probably won't be a challenge....

Xpages display attachment in dialog box from another document

xpages,attachment

To show all rich text field's attachments of "another" document in a fileDowndload control: add a panel around your fileDownload control, add a dominoDocument data source to the panel set attribute documentId to "another" document's UNID set fileDownload's value to document's rich text field (in your case the rich text...

loading a javascript library and not getting an object returned

xpages

hammer.js uses AMD. Here's a snippet from the hammer.js source code where AMD is used: if (typeof define == TYPE_FUNCTION && define.amd) { define(function() { return Hammer; }); } else if (typeof module != 'undefined' && module.exports) { module.exports = Hammer; } else { window[exportName] = Hammer; } Unfortunately AMD...

XPages - extlib 9.0.1v12 and JQuery 2.11

xpages,xpages-extlib

As you already said JQuery 2.x drops support for IE 8 and lower. To support IE 8 and lower, you will have to use jQuery 1.x. I think you will have to load Bootstrap manually, and won't be able to take advantage of the latest ExtLib with built in Bootstrap....

Xpages error when saving document in different DB in XPiNC

xpages

Looking at the stack trace, it's failing in Process Validations phase - so checking datatypes for validation / data conversion, and failing on the DateTimeHelperRenderer. It looks like that's pointing to computedField2. There are two possible explanations: One of the view entries has a value in column $1 that cannot...

Partial refresh in XPages causing other controls to not execute event handlers?

xpages

You need to change your approach. Instead of a partial refresh, have an independent Ajax call to an XAgent for your locking (IMHO 5 sec is way to frequent, the WebDAV standard uses 30sec). The openNTF WebDAV project has locking code you might be able to repurpose for your needs....

validate edit box input text length on xPage

xpages,lotus-notes

Add an client side event handler "onkeyup" to your inputText control: <xp:eventHandler event="onkeyup" submit="false"> <xp:this.script><![CDATA[ thisEvent.srcElement.value = thisEvent.srcElement.value.substring(0, 20) ]]></xp:this.script> </xp:eventHandler> It shortens the text to max length if necessary. You can show the message as alert var element = thisEvent.srcElement; if (element.value.length > 20) { element.value = element.value.substring(0, 20);...

Adding a document to another document through modal checkbox selection

javascript,html5,twitter-bootstrap,xpages

I'd suggest that rather than trying to add the events to the Person document, that you simply add the Person's name to an attendee field on each Event document selected. Then, you can display the events to which the person has been added using what we'd call in 'old Notes',...

Better way to Add fields up and display total

javascript,xpages

If you need to sum several inputs, maybe you could set the same css Class for them, and then use a css selector to get all of them and do the maths: <xe:djNumberTextBox styleClass="reg"></xe:djNumberTextBox> then you can use a csjs function like this: // i.e. pass to the function '.reg'...

Custom Error XPage: Ability for Browser to Load and Execute JS Script Link or Block After Being Loaded On Error

javascript,dojo,xpages,xpages-ssjs

OK, last try. A very interesting one. On your Error.xsp, add the following image: <xp:text escape="true" id="executeOnAjax" tagName="img"> <xp:this.attrs> <xp:attr name="src" value="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="> </xp:attr> <xp:attr name="onload" value="alert('Hello World!');this.parentNode.removeChild(this);"> </xp:attr> </xp:this.attrs> <xp:this.rendered> <![CDATA[#{javascript: var ex = facesContext.getExternalContext(); var...

I created my own logger in Java. Is it a bad idea? [closed]

java,logging,xpages,lotus-notes

I had have lot of compatibility problems between the log libraries like SLF4J, Log4J, java.util.logging, etc. and Lotus Notes. Without knowing what those issues were, it is difficult to advise you. There may have been a simple fix or work-around. Is it a bad idea to write a logger?...

Large bootsrap dialog from extlib focus on the bottom

modal-dialog,xpages,bootstrap,xpages-extlib

Dialogs from the ExtLib use Dojo. Even if you have the Bootstrap theme enabled: it's still a Dojo dialog, only the CSS (and some HTML) is different to give it the Bootstrap look. By default a Dojo dialog sets the focus on the first focusable element it finds in the...

Difference between note id and universal id

lotus-notes

The universal ID uniquely identifies a document across all replicas of a database. The universal ID is a 32-character combination of hexadecimal digits (0-9, A-F). If two documents in replica databases share the same universal ID, the documents are replicas. If you modify the UNID of an existing document, it...

How to trigger the onError client side event

javascript,xpages,xpages-ssjs

You could send back your own status code in the SSJS or Java event: <xp:this.action><![CDATA[#{javascript:facesContext.getExternalContext().getResponse().setStatus(999);}]]></xp:this.action> To prevent the console logging, you can disable them with the failOk parameter of Dojo's xhr request (disables the console logging for all requests): if( !dojo._xhr ) dojo._xhr = dojo.xhr; dojo.xhr = function(){ try{ var...

Doclink not opening in xpages

xpages,xpages-ssjs,xpages-extlib

I guess you want to create a link to XPage's current document in your email. You might have a data source defined in your XPage which is named "document1" as default <xp:this.data> <xp:dominoDocument var="document1" action="editDocument" ... </xp:dominoDocument> </xp:this.data> Then, your code would look like this: var documentMail:NotesDocument = database.createDocument(); var...

How to reset entered data of xp:inputs?

xpages

Reload the page with the same URL including parameters when Cancel button is clicked. This will reset all input values. Add context.redirectToPage(context.getUrl().toString()) to your Cancel button as SSJS code: <xp:button value="Cancel" id="button1"> <xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="true" save="false"> <xp:this.action><![CDATA[#{javascript: context.redirectToPage(context.getUrl().toString()) }]]></xp:this.action> </xp:eventHandler> </xp:button> An...

Trying to delete the selected item in the XPages repeat control, but does not work

xpages,control,repeat,delete-row

You just have to change "onClick" to "onclick" in your code and it will work. Case sensitivity does matter in Xpages. So, your code to delete a document is right but the event "onClick" doesn't gets executed at all....

How to pass a reference to a file from Java in xpages

java,xpages,xpages-ssjs,xpages-extlib,ssjs

You just want to transfer the query result to browser client for download and don't want to save it. Instead of saving the query result to a file first and transfer it for download later you can stream the content direct to XPage's response like this: public static void downloadFile()...

Is it possible to develop a login xpages base on Lotus Notes Email Client Account?

xpages,lotus-notes

The login process is a server based process and not based on the database directly. First of all the Domino- server you try to access has to be configured to use a session based login, otherwise you are not able to use a login page and might be asked for...

XPages checkboxgroup and default value

checkbox,xpages

Dan, Two things to try: Easy Fix #1: Change default value to the itemValue. So this in the default value: return "1"; Easy Fix #2: Put code in beforePageLoad to set the default value to the data that it is bound to. For example: If checkbox is bound a viewScope...

How to return the image to the url of java without saving to disk

java,xpages,lotus-domino

You can create an XAgent that calls your getImage() method to return the URL to xp:image. Here's an example of an XAgent for that: <?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom" rendered="false" viewState="nostate"> <xp:this.beforeRenderResponse><![CDATA[#{javascript: com.company.getImage(); }]]></xp:this.beforeRenderResponse> </xp:view> You need to modify your getImage() method to stream the image back. Here's an...

Is there any difference for XPages urls using action=openDocument and action=readDocument?

xpages

I don't know of a difference. Honestly I never use these URL's anymore myself. So it's really not a big deal very likely. Keep in mind, you don't need to use these at all of you don't want. You can pass your own parameter in the URL and then via...

xpages SSJS: cannot get rid of “com.ibm.xsp.acl.RedirectSignal” warnings in log

xpages,xpages-ssjs

In SSJS you don't define the type/class of the exception in the catch block. Since you're not doing anything with the "exception", there's also no need to import the RedirectSignal class. try { context.reloadPage(); } catch ( redirectSignal ) { // Ignore redirect signal "exception" } ...

Open mail database in new tab from XPiNC database

xpages

As stated in the comment: Take the domain name (@Scoular in the example) out of your link. then it will work

com.ibm.xsp.extlib.relational.library. This library cannot be found

xpages,xpages-extlib

From the name of the plugin it looks like you have installed the Domino Designer plugins and not the server plugins on the server - notice the .designer.relational part of the name. Make sure to install the plugins in the updateSiteOpenNTF.zip file and not from the updateSiteOpenNTF-designer.zip file....