Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7583199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:37:24+00:00 2026-05-30T18:37:24+00:00

To check whether value is numeric in LS, I would write the following code:

  • 0

To check whether value is numeric in LS, I would write the following code:

Dim strVal as String
Dim dVal as Double

strVal = doc.fldValue(0)

If IsNumeric(strVal) Then
    dVal = cdbl(strVal)
End If

How would we achieve this within XPages? I just tried getItemValueString on a numeric field and it didn’t work. getItemValueDouble worked, but as we all know we cannot rely on that field value to be numeric (in case some rogue agent is ran and converts a field on a particular document to be a text field by mistake!), so how do we check whether it’s numeric or not in XPages? Is there an easy way to achieve this or do we have to use getItemValue and check through the vector object? Has anyone else noticed this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:37:25+00:00Added an answer on May 30, 2026 at 6:37 pm

    In my experience when you are saving a numeric value it will be returned as a double value. If you want to be sure which datatype the .getitemvalue(“field”) value returns, you can use the .getClass() method on the returned value. for instance when you want to print it to the console:

    var x = doc.getItemValue("fieldx").get(0)
    
    if(x!=null){
      print(x.getClass());
    }
    
    because of this you can use code like this: 
    
    var x = doc.getItemValue("fieldx").get(0) // get first value of the field
    if(x != null){
      if(x instanceof java.lang.Double){
    
      } 
    
      if(x instanceof java.lang.Integer){}
    }
    

    or… you could just use

    @IsNumber() 
    

    😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to check whether a string contains any numeric value by jquery? I search
in C# , how can i check whether the value stored inside a string
I am using this code to check whether a value (guid1) already exists in
I wrote this sample code to check whether integer or string index is better
I would like to check whether user checked box or not with php code.
I have a String variable abc . Now I would like to check whether
I want to check in zend, whether a posted form value 'name' contains a
I want to I check whether a string is in ASCII or not. I
How can you check whether a string is convertible to an int? Let's say
I would like to check whether an object (e.g. someObject ) is assignable (cast-able)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.