SETFILTER with wildchar and a parenthesis () in filter value

gmtorino
Member Posts: 2
Anyone know how to... ?
I have to filter all records where a field (eg. description in Item) contains the following value: (E)
The parenthesis "(" is part of the value but after trying diffent way I didn't get out of it.
The code would look like this:
I have to filter all records where a field (eg. description in Item) contains the following value: (E)
The parenthesis "(" is part of the value but after trying diffent way I didn't get out of it.
The code would look like this:
gRecItem.RESET ; gRecItem.SETFILTER(gRecItem.Description,'*(E)*') ; IF gRecItem.FINDFIRST THEN REPEAT ; gRecItem.Extra := 'E' ; gRecItem.MODIFY ; UNTIL gRecItem.NEXT = 0 ; MESSAGE('Done') ;
0
Comments
-
is there a space around the (E)?
then * ?E? *0 -
Hi,
have you tried: gRecItem.SETFILTER(gRecItem.Description,'*%1*','(E)') ;
or: gRecItem.SETFILTER(gRecItem.Description,%1,'*(E)*') ;?
you could also try this:
gRecItem.RESET ;
IF gRecItem.FINDSET(TRUE,FALSE) THEN REPEAT
IF STRPOS(gRecItem.Description,'(E)') <> 0 THEN BEGIN
gRecItem.Extra := 'E' ;
gRecItem.MODIFY ;
END:
UNTIL gRecItem.NEXT = 0 ;
MESSAGE('Done') ;0 -
Try this:
setfilter(Description,'%1|%2|%3|%4','@*(E)*','@*( E)*','@*(E )*','@*( E )*'); //here a loop if needed
The @ you can leave if you need a upper E. If you search for e/E set the @.
If you see, the code filter also Descriptions where a space is between the letters. If there is a other letter (not space) between this characters, you can also use harry's solution (@*(?E?)*).
RegardsDo you make it right, it works too!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions