AnsweredAssumed Answered

Date field wildcards

Question asked by jdevans on Nov 18, 2016
Latest reply on Nov 19, 2016 by beverly

I'm scripting a find on a List view. I've created a script that is designed to "filter as you type." It works well, until I get to a date field. I've got a handler for the date that uses a Let statement, and Case inside that. I have the let store var1 to the final search criteria. This fires as the user types, putting the cursor back at the end of whatever they've typed.

 

However, I have the Case portion of the Let statement fill in the rest of the date search based on whatever the user has typed up to that point in time.

 

The highlighted section below is failing. I get an error 500. (Date value does not meet validation entry options). I've tried using several wildcards to find for example, any date that begins with 12/2. The error 500 happens apparently because FM doesn't like 12/2*/* as a search criteria for a date. I've tried using "#/*" which gives error 500, as well as "@/*" which also give error 500. Not sure what to do to narrow down the dates based on 4 character date, with the first slash falling at position 3.

 

Let (

  [ var1 = Drawing_Numbers::x_release_date_filter ];

 

 

  Case (

 

 

  var1 = "0" ;

  "*/*/*";

 

 

  Length ( var1) =1 ;

  var1 & "/*/*";

 

 

  Length ( var1 ) =2 and

  Left ( var1 ; 1 ) = "0";

  Filter ( var1 ; "123456789" );

 

 

  Length ( var1 ) =2

  and Position ( var1 ; "/" ; 1 ; 1 ) =2 ;

  var1 & "*/*";

 

 

  Length ( var1) =2 ;

  var1 & "/*/*";

              

               Length ( var1 )= 3 ;

  var1 & "*/*";

 

 

  /*this looks for 3char date with 1st slash at 2nd pos- (1/2) */

               Length ( var1 ) =3 and

               Position ( var1 ; "/" ; 1 ; 1 ) =2 and

               Left ( var1 ; 3 )  ≥ 4;

               var1 & "/*";

 

 

  /*this looks for 4char date with 1st slash at 3rd pos- (12/2) */

               Length ( var1 ) =4 and

               Position ( var1 ; "/" ; 1 ; 1 ) =3 ;

               var1 & "*/*";

              

  /*this looks for 2nd slash at 4th pos- (1/2/) */

               Length ( var1 )= 4

  and Position ( var1 ; "/" ; 1 ; 2 ) =4;

  var1 & "*";

 

 

  /*this looks for 4character date with 1st slash at 3rd         

                pos- (12/2) */

  Length ( var1 )= 4

  and Position ( var1 ; "/" ; 1 ; 1 ) =3;

  var1 & "/*";

 

 

  /*this looks for 1st slash at 2nd pos- (1/) */

  Length ( var1 )= 4

  and Position ( var1 ; "/" ; 1 ; 1 ) =2;

  var1 & "/*";

 

 

  Length ( var1 )= 5

  and Position ( var1 ; "/" ; 1 ; 1 ) =2

  and Position ( var1 ; "/" ; 1 ; 2 ) =5;

  var1 & "*";

 

 

 

 

  var1

 

 

  )

 

 

)

Outcomes