Community articleisValidFormat method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method returns the boolean result of whether a string is valid according to the setting of the node's format option.

Method

   public boolean isValidFormat(
      String theString
   ) throws UWIException;


Parameters

Table 1. Method parameters
ExpressionTypeDescription
theStringString
A string to be checked against the format. For example, to check 23.2 against a specific format, the string would be “23.2”.


Returns

True if the string does match the format, false if it does not.

Example

The following function locates the Currency field and checks to see if “23.2” conforms to the format required by the field's format option.
   public boolean checkFormat(formNodeP theForm) 
      throws Exception
   {
   FormNodeP theItem;
 
      /* Locate the Currency field */
 
      if ((theItem = theForm.dereferenceEx(null, "PAGE1.Currency", 0, _
         FormNodeP.UFL_OPTION_REFERENCE, null)) == null)
      {
         throw new UWIException("Could not locate the Currency node.");
      }
 
      /* Check the string to see if it is invalid*/
 
      (theItem.isValidFormat("23.2") == false)
      {
         throw new UWIException("The value is not correctly formatted.");
      }
      else
      {
          System.out.println("The value is formatted correctly.");
      }
   }


Parent topic:
FormNodeP class