Joined: 15 Jan 2009
Online Status: Offline
Posts: 35
Topic: Issue with InStr and field with spaces Posted: 23 Aug 2011 at 5:24am
Good Day,
I am having trouble with the InStr function in Crystal.
I am using Crystal Report s XI.
Here are my fields in my report:
Field Headers Company Ticket Number Company_Multiple xyz company C123456 abc company def company ghi company jkl company
The Company Multiple field is a memo field.
The data in the field may have a number of spaces in between each company entry. In some cases, the field data could look like this:
abc company def company ghi company jkl company
I created a formula called CompanyAffected ============================================ numberVar i := 0; numberVar j := 0; stringVar out := " "; stringVar array test := split({cm3rm1.company_multiple}, chr(10)+chr(13) ); i := ubound(test); if i > 0 then for j := 1 to i step 1 do out := out + UpperCase(test[j]) + " "; out ============================================
I then have a parameter called ?My Parameter. This parameter would allow a user to type in a Company name to get all the Ticket Numbers where the Company is in the company_multiple list.
In my record selection, I have put in: ==============================================
In the case where I the company_multiple look like this:
abc company
def company ghi company
jkl company
I can choose the parameter of abc company and the tickets will come back.
But, if I choose the company def company or jkl company, the records won't appear. It's like my formula will only see the company if it is the first entry in the company_multiple list. How can I get the tickets for a company if they are not the first entry in the company_multiple list?
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 23 Aug 2011 at 6:14am
not quite sure why you are splitting it into an array. If you are just typing in one company name and checking it against a field you can use the instr option directly at the field and make it case insensitve...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum