# 9.05.702 - Crystal Syntax for finding the position of an item in

I have not worked with creating my own functions, I will have to work on this one a bit.

I do think the split command is the answer.

I just needed the first 2 positions for now and did it using MID, LENGTH, INSTR command.

I know there must me a shorter/simpler coding method but works for now.

Patrick

IF

Length({BAQReportResult.SalesRep.SalesRepCode}))

= {BAQReportResult.SalesRep.SalesRepCode} then 1

Else IF

Length({BAQReportResult.SalesRep.SalesRepCode}))

= {BAQReportResult.SalesRep.SalesRepCode} then 2

Else 0

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, September 09, 2014 10:01
To: vantage@yahoogroups.com
Subject: [Vantage] Re: 9.05.702 - Crystal Syntax for finding the position of an item in a string.

Good Morning,

I use a custom function in crystal and call it. I know there are 5 members in array and I get the member out by:

Function (StringVar SplitRepList, numbervar ListMemberNum)

If ListMemberNum=1 then if Split(SplitRepList,"~")[1]<>"" then Split(SplitRepList,"~")[1]

else if ListMemberNum=2 then if Split(SplitRepList,"~")[2]<>"" then Split(SplitRepList,"~")[2]

else if ListMemberNum=3 then if Split(SplitRepList,"~")[3]<>"" then Split(SplitRepList,"~")[3]

else if ListMemberNum=4 then if Split(SplitRepList,"~")[4]<>"" then Split(SplitRepList,"~")[4]

else if ListMemberNum=5 then if Split(SplitRepList,"~")[5]<>"" ; then Split(SplitRepList,"~")[5]

This email and any attached files are confidential and intended solely for the intended recipient(s). If you are not the named recipient you should not read, distribute, copy or alter this email. Any views or opinions expressed in this email are those of the author and do not represent those of the Specialty Screw Corporation company. Warning: Although precautions have been taken to make sure no viruses are present in this email, the company cannot accept responsibility for any loss or damage that arise from the use of this email or attachments.

Data

Report Builder
Would return 2 for the SalesRepCode = 'PROCOM'

Any suggestions for crystal syntax?
InStr returns a 6 which is close but I need the Item position not the actual string position if you know what I mean.

Patrick Winter
Epicor 9.05.702, Progress Database, Windows Server 2008 R2 Standard
Progress 10.2a, Service Pack: 03, Hotfix: 29, Progress Build 1390
Crystal Runtime 2010, SP3
Crystal Developer 2008, SP4

[Non-text portions of this message have been removed]

What if you split it into an array, for loop it until you reach the value you are looking for, then “I” would be your position.

Joshua Giese

CIO

Direct:     920.593.8299

IT Dept:   920.437.6400 Ext. 337

Site ID:    27450-E905700B2-SQL64

Wisconsin Converting, Inc.

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, September 9, 2014 8:17 AM
To: 'Yahoo Groups - Vantage (vantage@yahoogroups.com)'
Subject: [Vantage] 9.05.702 - Crystal Syntax for finding the position of an item in a string.

Data

Report Builder
Would return 2 for the SalesRepCode = 'PROCOM'

Any suggestions for crystal syntax?
InStr returns a 6 which is close but I need the Item position not the actual string position if you know what I mean.

Patrick Winter
Epicor 9.05.702, Progress Database, Windows Server 2008 R2 Standard
Progress 10.2a, Service Pack: 03, Hotfix: 29, Progress Build 1390
Crystal Runtime 2010, SP3
Crystal Developer 2008, SP4

[Non-text portions of this message have been removed]

Have you tried adding a calculated field to the BAQ (instead of trying to do it in Crystal.
i.e

IF ( Num-entries(OrderHed.SalesRepList,"~~~~")>=2) then
(Entry(2,OrderHed.SalesRepList,"~~~~")) else ""

Good Morning,

I use a custom function in crystal and call it. I know there are 5 members in array and I get the member out by:

Function (StringVar SplitRepList, numbervar ListMemberNum)

If ListMemberNum=1 then if Split(SplitRepList,"~")[1]<>"" then Split(SplitRepList,"~")[1]

else if ListMemberNum=2 then if Split(SplitRepList,"~")[2]<>"" then Split(SplitRepList,"~")[2]

else if ListMemberNum=3 then if Split(SplitRepList,"~")[3]<>"" then Split(SplitRepList,"~")[3]

else if ListMemberNum=4 then if Split(SplitRepList,"~")[4]<>"" then Split(SplitRepList,"~")[4]

else if ListMemberNum=5 then if Split(SplitRepList,"~")[5]<>"" then Split(SplitRepList,"~")[5]