renatomitsunami Posted November 22, 2017 Share Posted November 22, 2017 Hi..I'm trying to use a mask filter in a field, like this example: Name TicketJohn123456/2017Mary564587/2017Anthony698/2017Peter1356/201After apply mask filter in "Ticket" field, the expected result is: Name TicketJohn123456/2017Mary564587/2017Ticket field with "######/####" format.How can I apply this filter ?Thanks. Link to comment Share on other sites More sharing options...
MiditecReportDev Posted November 24, 2017 Share Posted November 24, 2017 You could try it with using a PrintWhen-Expression on the field, using $F{Ticket}.length == 6 if the first part of the value in your text field is $F{Ticket}. Then if the second part is some other field just use "$F{Ticket}.length == 6 && $F{OtherField}.length == 4" Link to comment Share on other sites More sharing options...
MiditecReportDev Posted November 24, 2017 Share Posted November 24, 2017 You could try it with using a PrintWhen-Expression on the field, using $F{Ticket}.length == 6 if the first part of the value in your text field is $F{Ticket}. Then if the second part is some other field just use "$F{Ticket}.length == 6 && $F{OtherField}.length == 4" Link to comment Share on other sites More sharing options...
renatomitsunami Posted November 24, 2017 Author Share Posted November 24, 2017 Hi PEichelberg,I need to count the numbers of occurences in correct pattern format "XXXXXX/XXXX" = (6 characters before "/" and 4 characters after "/")>> IF $F{Ticket} contains a string with correct format THEN 1....Else 0.In this example, 2 corrects rows: Name TicketJohn123456/2017Mary564587/2017 Thanks again Link to comment Share on other sites More sharing options...
renatomitsunami Posted November 27, 2017 Author Share Posted November 27, 2017 Hi PEichelberg,I need to count the numbers of occurences in correct pattern format "XXXXXX/XXXX" = (6 characters before "/" and 4 characters after "/")>> IF $F{Ticket} contains a string with correct format THEN 1....Else 0.In this example, 2 corrects rows: Name TicketJohn123456/2017Mary564587/2017 Thanks again Link to comment Share on other sites More sharing options...
MiditecReportDev Posted December 8, 2017 Share Posted December 8, 2017 Okay ... so basically you want to only display those $F{Ticket} that match your format of ######/#### and hide every other one ... So what you need to do is get your data as usual but then in the Dataset and Query Dialog go to tab Filter Expression. Put $F{Ticket}.matches(REGEX) == true there. Or == false. I'm currently not sure which one would help actually :D REGEX should be a String pattern like this: d{6}/d{4} You can check the meaning of this at https://regex101.com/ as I did too. Basically that regex checks if you've got a string that has six digits, a slash and four further digits. If so, the regex says your string is valid. As I said, I don't know if you need to say == true or == false in FilterExpression, but you can figure that out easily. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now