Checking what a value is in SSJS

I have this block of code in SSJS that I'm doing some field validation stuff: thisDoc is a NoteXspDocument fld = the name of a field

var thisValue = thisDoc.getValue(fld);
print("Check Text = " + thisValue);
print("Is is a Date " + (thisValue === Date))

when I run it the log has this:

Check Text = 09/10/15 12:00 PM
Is is a Date false

In this code I do not know what the datatype is of the fld which is a field name. I check the backend document and get the NotesItem.Type() and this field is of type text 1280 in the backend, but the NotesXspDocument has a date. I need to determine what the data type is thisValue sure acts like a NotesDateTime object, but I'm doing something wrong somewhere. I think the issue might be the difference between a NotesDateTime and a java.util.Date but they drive me up the wall.

Further Edit -- The problem is that I have an Array of field names var Fields:Array that I then loop through and get fld = Fields[n] so when I get the value of the field it could be anything Text, Date, Number so when I do var thisValue = thisDoc.getValue(fld) or thisDoc.getItemValue(fld) I need to figure out what kind of value I have. I guess I could put the getItem..... inside a try until I find one that works but that seems like a less than optimum solution.

Try instanceof Date.class. What you've got is not checking the data type of thisValue against the underlying class, instead it's checking the object itself.

xpages - Checking what a value is in SSJS, Try instanceof Date.class . What you've got is not checking the data type of thisValue against the underlying class, instead it's checking the object itself. Fortunately, there is a way to peek in on parameter and variable values when debugging packages in SQL Server Data Tools. Using breakpoints and the Locals window, one can monitor these variables during execution to help identify potential issues in the package design. Checking SSIS Variable and Parameter Values.

Because the field that I am retrieving can be just about anything I use

var thisValue = thisdoc.getValue(fld);

i had a lot of trouble then determining what kind of data I had. It could be a null Date/Number/String So the first thing I did was find out what the backend data type was:

var thisItem:NotesItem = thisDoc.getDocument().getFirstItem(fld);
var type:Integer = thisItem.getType()

This helps somewhat if the field has been previously set, but if it is a new document or the field has not received a value yet it will be type 1280 or text and probably null. So my fisrt test is for null or "". then it becomes a bit tougher because I need to test for some values. In all my comboboxs I add the text "--- Select ?????" as the first item in the list so I tried to get a substring of "---" but because of variance in the datatype I needed to put that in a try:

try{
if (thisValue.substring(0,3) == "---"){
print("have null Prefix");
rtn = false;
errMsg.push("The field " + fld + " is a Required Field please enter a value");
break;
}catch(e){ etc

I then wrapped the various other datatype tests in trys and now I have it working. Might be a better way but this works.

Checking what a value is in SSJS - xpages - Python, Checking what a value is in SSJS - xpages. getValue(fld); print("Check Text = " + thisValue); print("Is is a Date " + (thisValue === Date)) when I run it the log  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". You can also see that a multi-value of from the replaceItemValue page of the Domino Designer Knowledge Center. To accomplish the same with the NotesDominoAPI (in SSJS), we'll need to:

Use .getItemValue() to return a vector array, then test the data type. You can also try .getItemValueString() to return a text string or .getItemValueDate() or .getItemValueDateTime() to return date/time.

Since getItemValue() returns an array, use subscript to get the first element:

var thisValue = thisDoc.getItemValue(fld);
var thisIsDate = (thisValue[0] instanceof Date);
print("Check Text = " + thisValue[0]);
print("Is this a Date ? " + thisIsDate;

Checking what a value is in SSJS - xpages, I have this block of code in SSJS that I'm doing some field validation stuff: thisDoc is a NoteXspDocument fld = the name of a field var thisValue = thisDoc. The trick of this is to think of a multi-value NotesItem as an array of values. Or more accurately, an Array. The SSJS getItemValue returns an array of values just like the LotusScript getItemValue. But the beauty of SSJS is that you can use the JavaScript Array object to easily append or prepend new values.

This works find for me in ssjs Block

Write('alert("Check Text = = '+thisValue+'");');

SSJS indexOf not supported?, You can not get the array value directly without using array index number . you should pass the index number to determine whether the value is contained in the​  To build our NULL Defense for this problem there are two parts to this solution. One part is validating if the field in the row being processed contains a null value and the second part is assigning NULL or valid values to parameters based on values found in the fields. Edit the script and change the code as shown below and execute the package.

Variable.GetValue | Programmatic Marketing Content, Variable.GetValue Example. This sample code retrieves the value of the specified variable. Variable.GetValue("@myAmpVariable");. Last Updated: May 5​, 2020. Previous · Next Check out our GDPR resource site and find out how:  I have a booking form that needs to check to see if a booking is still available when someone clicks the book button. If it is available I would like the SSJS code behind the button to process (this then updates some values on the booking form), however if on checking the booking it is no longer available, I would like to do a partial refresh of a different panel (a panel within the main panel

XPages Extension Library: A Step-by-Step Guide to the Next , Listing 6.5 shows a button that runs SSJS to trigger an agent to run on the server. If the agent runs successfully, line 16 creates a variable that accesses the of the eventHandler would then have used Client-Side JavaScript to check that  In XPages, the strict type-checking won't allow you to do that. Instead, this is what works for XPages: var temp:java.util.Vector = doc.getItemValue("DateDue");

| Programmatic Marketing Content, You can use these attributes in your personalization strings: Name - Identifies the attribute, sendable data extension field, or variable. You must include this value  Xpages get a handle on next rowData or Doc in a repeat Tag: xpages , xpages-ssjs In my repeat control I want to be able to get a handle on data in the next row in order to modify what data is displayed in my current row (I have move up and down actions, and I don't want to display them if the move is not possible).