Page 1 of 1

TurboIntegrator Process

Posted: Fri Jun 29, 2012 1:23 am
by mhackTM1
Good day everyone! I just want to ask something about parameter in TurboIntegrator process. I have a parameter vNewYear and the user will input a year (eg 2013) However, I'm experiencing difficulty in the input. I want the user to input number only, regardless of length because I used the SUBST to get only the first four of the input. Here's the problem, the user can also input letters for year (eg abcd) and it will be added to the dimension element. I don't want the letters to be part of the dimension because it is intended for years only (eg 2012, 2013). May I know the syntax for this? example, if the user inputs 'ab2013' the process will not take place. '20bc13' the process still will not take place. '2014abc', the process will only get 2014 (given). Thank you in advance :)

Re: TurboIntegrator Process

Posted: Fri Jun 29, 2012 1:44 am
by rmackenzie
The NUMBR function might be the one to use here as it will ignore non-numeric characters in the input. E.g.

Code: Select all

nTest1 = Numbr ( '20ab32cd' );
nTest2 = Numbr ( 'abcd');
nTest1 will be 2032, and nTest2 will be 0. So, perhaps your Prolog code should read:

Code: Select all

nLength = LONG ( vNewYear );
IF ( nLength < 4 );
  # can't have given a correct input?
  ProcessError;
ENDIF;
sFirstFourChars = SUBST ( vNewYear, 1, 4 );
nYear = NUMBR ( sFirstFourChars );
IF ( nYear < 2000 );
  # can't be a good input
  ProcessError;
ENDIF;
# carry on with nYear

Re: TurboIntegrator Process

Posted: Fri Jun 29, 2012 2:46 am
by mhackTM1
Thank you for your response Sir. This will help :)