Posts Tagged ‘js’

10 Feb 2016
0

The XPages Knowledge Base gets 2 new articles on day 1

Thanks to Paul Withers and Fredrik Norling, the XPages Knowledge Base grew by 2 articles in day 1 of the official launch.

Article: Dialog Control, SSJS and Refreshing an Area of the Page

Link: Click here to view article
Author: Paul Withers
Knowledge Base Space: XPages Extension Library
 
Short Description
Get an understanding of what happens behind the scenes when performing an SSJS .show() or .hide() on a Dialog Control.
 

Article: Adding excel exporting to XPages using POI4XPages

Link: Click here to view article
Author: Fredrik Norling
Knowledge Base Space: POI4XPages
 
Short Description
This article will show you how to create and run a simple view to excel export using POI4XPages, which is an OSGI Plugin that adds Apache POI support to your XPage Project. This marks the first article for POI4XPages on the XPages Knowledge Base and officially takes it out of the “Coming Soon” status.

 

Closing

Just a final thanks to Paul and Fredrik for being the first 2 contributors to the Knowledge Base. I know both of you are already digging out more articles to contribute and I speak on behalf of the community when I say that we really appreciate it.

For those out there that also want to contribute, I recommend reading this post I submitted on what to expect and the necessary steps to take to become a contributor.

Cheers for now
John :)
19 May 2014
0

Quick Tip: Lessen your JavaScript code with 1 liner IF Statements

Not many people know this, but for simple JavaScript “If” Statements, there’s a Syntax that allows you to write out the entire condition on one line.

Let’s take a quick If Statement and type it out the most common way:

1
2
3
4
5
6
7
8
var whatAreMondays = "";
var areMondaysBlue = false;
 
if(areMondaysBlue){
   whatAreMondays = 'Blue';
}else{
   whatAreMondays = 'Awesome';
}

Behold…the 1 liner Syntax:

variable = (condition) ? 'value if TRUE' : 'value if FALSE';

By using a question mark and a colon, we can convert the above If Statement to the following:

1
2
3
4
var whatAreMondays = "";
var areMondaysBlue = false;
 
whatAreMondays = (areMondaysBlue) ? 'Blue' : 'Awesome';

Simple, but effective :)

17 Jan 2014
0

TiDomino is now an Idea Space on IdeaJam.net

Firstly, a big thanks to Mr Bruce Elgort for creating a category on IdeaJam.net for TiDomino.

For those who aren’t aware…TiDomino is a JavaScript module that allows Appcelerator Titanium developers to use IBM Domino programming patterns to structure local data sets and integrate with IBM Domino and XWork Applications.

IdeaJam.net is an online social site that uses the power of “crowd-sourcing” to rank ideas and allow the best ideas to rise to the top. (NOTE: IdeaJam is available as a product for companies that are interested. Speak to Mr Bruce Elgort or Click here for more info)

SO WHERE TO FROM HERE?

To date, there have been 83 downloads of TiDomino from OpenNTF. I published the very first version on the 29th November 2013 and provided a 2nd release on the 13th December. The 2nd release was motivated by a suggestion that Sean Cull raised during his testing of TiDomino.

Now, I already have my To Do list for the next release of TiDomino, which I’m targeting for February, once IBMConnect is over and the dust has settled.

However, moving forward, I really want to urge everyone who’s interested in this community product, to raise ideas and suggestions on IdeaJam. I would love nothing more than to turn this into an Uber product that makes sense for everyone in terms of usability and time saved on programming.

I, myself will be listing all the ideas I currently have for this product. I look forward to everyone’s feedback and involvement on this. I’ll see you on the other side!!

John

8 Nov 2013
0

Live chat assist about searching for data in a NotesView via XPages

Summary

This live chat got me thinking that it’s not a good idea to assume that people asking for help are seasoned Domino Developers who have moved to XPages. You’ll see towards the middle of the chat how I finally realized this.

Click here to view the Blog Post I submitted related to this query.

Enjoy :)

Live Chat – 25th October 2013

John Jardin:
Good day. How can I help :)
 
Guest:
Hello. How do I compare stored values in JavaScript?
 
John Jardin:
When you say stored values, are you referring to a Notes Document or a Document Data Source?
 
Guest:
Data Source. I store values in a Database.
 
John Jardin:
So let’s say you have a Document Data Source called “doc1″, and you want to compare 2 string values in that Data Source. In Server Side JavaScript, it would be something like….
 
1
2
3
if(doc1.getItemValueString("Field1") === doc1.getItemValueString("Field2")){
   //Do Something
}
Guest:
Ok but how will that access data from a Database? How do I check it with a list of values?
 
John Jardin:
So, do you understand and have you worked with LotusScript in the past?
 
Guest:
no…
 
John Jardin:
OK. So I will do you a favor. I will publish a blog post with a detailed example of how to achieve this. But I want to just make double sure I’m understanding you correctly. You want to take a value in one of the fields in your XPage and compare it to a list of values stored in the Notes Database in a View?
 
Guest:
Yes exactly.
 
John Jardin:
OK great. Please allow me a few hours to publish this.
 
Guest:
Yea sure n thank you.
26 Oct 2013
0

XPages Tip: Comparing a value in your XPages with backend data

I forget sometimes that many who have taken the path of XPages, are not necessarily existing Domino Developers who understand the Domino Object Model. This is a quick tip on how to take a field value from your XPages App, and compare it with data inside a Notes Database, and more specifically, a Notes View.

The Back-End Database

Let’s say you have a Notes Database with a view called “Fruits“. This view has 1 column called “Fruit Name” and is sorted in ascending order. Inside this view you have a few Notes Documents listed based on the following fruits captured:

FuitsViews

The XPage

Next, you have a very simple XPage with a Text Field called “inputFruit“, where a user will enter a fruit name of their choosing. The XPage also has a button called “Submit” and calls the following Server Side JavaScript Function – checkFruits();

FruitsXPage

The JavaScript Function

Here we create a JavaScript Function called checkFruits(), which will use the value entered and check if it exists in the Notes Database:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function checkFruits(){
   //Set our variables
   var doc:NotesDocument = null;
   var view:NotesView = database.getView("Fruits"); //Get a Handle on the Database View
   var key = getComponent("inputFruits").getValue(); //Get the entered value
 
   //Check if fruit entered exists
   doc = view.getDocumentByKey(key, true) //The 2nd parameter 'true' means 'Exact Match'
   if(doc !== null){
      print("The Fruit Exists");
   }else{
      print("No Fruits Founds");
   }
 
   //A JS Function should always return something
   return true;
}
Hope this helps :)
John