|
-
Jul 14th, 2000, 06:58 AM
#1
Thread Starter
New Member
Dear all,
I wonder if anyone could help me with this problem. I'm using Rational's SQA suite and its inbuilt SQABasic to create a robot script that reads data from a .csv file. Unfortunately, SQABasic does not come with the Split function that I am used to in VB so I am stumped as to how to solve this problem effectively. Unfortunately, I do not have access to VB whilst doing this job, so I can't use that with SQA suite. The only way I've managed it so far is to use a collection of loops to split it manually but it is a very time-consuming process when working with large .csv files. Has anyone got any ideas as to how to go about effectively reproducing the Split function?
Thanks in advance,
Greg.
-
Jul 14th, 2000, 10:48 AM
#2
The Split Function:
Code:
Function Split(ByVal sIn As String, Optional sDelim As String, Optional nLimit As Long = -1, Optional bCompare As VbCompareMethod = vbBinaryCompare) As Variant
Dim sRead As String, sOut() As String, nC As Integer
If sDelim = "" Then
Split = sIn
End If
sRead = ReadUntil(sIn, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit <> -1 And nC >= nLimit Then Exit Do
sRead = ReadUntil(sIn, sDelim)
Loop While sRead <> ""
ReDim Preserve sOut(nC)
sOut(nC) = sIn
Split = sOut
End Function
-
Jul 14th, 2000, 12:54 PM
#3
Thread Starter
New Member
Brilliant! Thank you so much, I can't thank you enough! I will try it first thing on Monday.
However, one thing bothers me. Will the "VbCompareMethod = vbBinaryCompare" variable type work in SQABasic which does differ from VB in some ways?
Thanks again,
Greg.
-
Jul 14th, 2000, 01:37 PM
#4
vbBinaryCompare is a constant of 0. vbCompareMethod is just an enumeration (enum) consisting of several constants.
-
Jul 17th, 2000, 07:16 AM
#5
Thread Starter
New Member
OK, I've tried it out but there are a few problems. It didn't like the compare method variable (and its type) but I just set it to 0. It also didn't like doing the -1 bit on nLimit so I set it to do it at the beginning of the function. Therefore I now have:
Code:
Function Split(ByVal sIn As String, sDelim As String, nLimit As Long) As Variant
nLimit = nLimit - 1
Dim sRead As String, sOut() As String, nC As Integer, bCompare As Variant
bCompare = 0
If sDelim = "" Then
Split = sIn
End If
sRead = ReadUntil(sIn, sDelim, bCompare)
Do
ReDim Preserve sOut(nC)
sOut(nC) = sRead
nC = nC + 1
If nLimit <> -1 And nC >= nLimit Then Exit Do
sRead = ReadUntil(sIn, sDelim)
Loop While sRead <> ""
ReDim Preserve sOut(nC)
sOut(nC) = sIn
Split = sOut
End Function
However, I now get the following errors when compiling:
- BYVAL is only supported in external functions argument 'sIn')
- Variable ReadUntil undefined
- Missing or incorrect subscripts for array sOut
I don't know what the first or last ones mean but the second one obviously means that SQABasic doesn't support the ReadUntil function either. Any ideas?
-
Jan 31st, 2006, 06:41 AM
#6
New Member
Re: Split function work-around in SQABasic
For split function I am getting following error after compilation
"Invalid procedure definition" for the split function
Also could you please help me in getting the function ReadUntil function.
Thanks & Regards.
Sachin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|