Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to take the results of array and split 4 elements of the array into 4 unique variables

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Hello I need to take the results of array and split 4 elements of the array into 4 unique variables

I am using the split function but only one row of a 7 row array is being split into 4 unique variable values


query = "select comment from planaction(nolock) " &_
" where primaryid ='$REFERRALID$'" & _
"and source = 'HealthTrio Auth Referral' " &_
"order by comment "

query = replace(query,"$REFERRALID$",QNXT_referralid)
Set rs300 = conn.Execute(query)




nfields_cpt=""
if (not rs300.eof) then 'check that we have at least one record
nfields_cpt =trim(rs300 ("comment")) 'return the referral text field to a string variable
end if

dim CPT_Procedure_Code_disp
dim CPT_Type_disp

Dim CPT_Code_disp
Dim CPT_Quantity_disp
dim Remarks_cpt
dim Nreason_cpt
dim Nvalues_cpt
dim iT
dim nfields_cpt


' code to separate cpt array



Remarks_cpt =nfields_cpt
Remarks_cpt=replace(remarks_cpt,chr(58),chr(10)) 'replace carriage return with line feed
'Remarks_cpt=replace(remarks_cpt,chr(58),chr(10)) 'replace double line feeds with single line feeds
Nreason_cpt=split(remarks_cpt,chr(10)) 'split on line feeds into an array
'• Nfield(0)= Requesting|JOHN SMITH|Phone|617-777-2222
'• Nfield(1)= Servicing|JOHN ADAMS|Phone|617-999-2222
'• NField(2)= Remarks|KEGIT1 09/28/12 06|15 TEST REMARKS
'

''Initialize variables for Nvalues array
CPT_Procedure_ Code_disp=""
CPT_Type_disp=""
CPT_Code_disp=""
CPT_Quantity_disp""


'
''Code to split the QNXT text field "comment" - this code will assign new variable names to array values - does this code need to be within a if end if - I previously had prefix values in different array - this array does not have any prefix but I still want to assign elements to individual vbscript fields'

'Dim iS - move up higher in code
For iT = 0 to ubound(Nreason_cpt)
Nvalues_cpt = Split(Nreason_cpt(iT),":")
'If Nvalues(1) = "CPT" Then

CPT_Procedure_Code_disp=Nvalues_cpt(0) ' note changing case to upper case to match QNXT
CPT_Procedure_Code_disp=Nvalues_cpt(1)
CPT_Code_disp=Nvalues_cpt(2)
CPT_Quantity_disp=Nvalues_cpt(3)

'End if
 
hi,

So what's the question?

Really don't understand why you would put each array element into a separate variable (from one variable to another???)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hello

The I need to split the comment field array because I need to compare the individual data elements - the comment field contains 4 separate fields that have been concatenated into a comment field rather using separate fields

The source of the comment field is a webapp where this elements are separate field values

I have a str compare process that will use these split out fields

 
Code:
For iT = 0 to ubound(Nreason_cpt)
  Nvalues_cpt = Split(Nreason_cpt(iT),":")
  CPT_Procedure_Code_disp=Nvalues_cpt(0) ' note changing case to upper case to match QNXT
  CPT_Procedure_Code_disp=Nvalues_cpt(1)
  CPT_Code_disp=Nvalues_cpt(2)
  CPT_Quantity_disp=Nvalues_cpt(3)
'[b][highlight]So...... you assign these 4 variables.  THEN WHAT? 
'Can't you use Nvalues_cpt(0) just as easily 
'as you can use CPT_Procedure_Code_disp???
[/highlight][/b]
Next
What's the QUESTION???

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hello,

I am able to get the 1st row of the array to be displayed using

Nvalues(0-3):

Here are the display results:


1
CPT
97140
1

However there are 7 rows of array data:

comment
1:CPT:97140:1
2:CPT:97110:1
3:CPT:97035:1
4:CPT:97033:1
5:CPT:97010:1
6:CPT:97014:1
7:CPT:97001:1

I need to be able to get all 7 rows displayed

What additional logic is needed to pull the other 6 rows of data?

Thanks
 
I would assign them to a 4x7 array, not 28 individual variables--WHAT A MESS!!!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Is there a way to remove the array elements so that I am only left with the third element - eg "97140" so that I can peform a strcomp against another array that only contains the CPT code?

In addition is there a way to add an additional data element(s) from a datatable in HP Quick Test pro to the array below:


Arrays to be compared with strcomp

Array with user entered data from Web app
97140;97110;97035;97033;97010;97014;97001



Array data from claim system admin system:
This array has additional data that I do not need to compare at this time; I would like to be able to remove all elements with the exception of the 5 digit code


1:CPT:97140:1
;2:CPT:97110:1
;3:CPT:97035:1
;4:CPT:97033:1
;5:CPT:97010:1
;6:CPT:97014:1
;7:CPT:97001:1
 
oh you mean strip an array down to only what you need. well, you have said you are able to do that will one line. why not do it with the other six? how did you get the first line?

Code:
strWebAppData = "97140;97110;97035;97033;97010;97014;97001"

for each strLine in arrRS300Comments
   arrComment = split(strLine, ":")
   if (inStr(strWebAppData, arrComment(2)) then
      'found
   else
      'not found
   end if
next

-Geates

 
The first array came from a HP Quick Test Pro datatable - the codes are medical procedure codes that are entered for individual members - member can have up to 15 procedural codes per medical authorization.

At some point I will need to create multidimensional arrays using columns from the datatable to compare to data in the database that has been concantenated into text fields


Here is the code where I establish the arrays
The code where the "datatable" is mentioned is the code that created the 1st array

query = "select comment from planaction(nolock) " &_
" where primaryid ='$REFERRALID$'" & _
"and source = 'HealthTrio Auth Referral' " &_
"order by comment "

query = replace(query,"$REFERRALID$",QNXT_referralid)
Set rs400 = conn.Execute(query)


Dim QNXT_cpt_codeX
Dim iW
iW=0
QNXT_cpt_codeX=""
Do while (not rs400.eof) 'loop as long as there are records
If (Qnxt_cpt_codeX<>"") then
Qnxt_cpt_codeX=qnxt_cpt_codeX & ";" 'use semi-colon as separator
End if
Qnxt_cpt_codeX = qnxt_cpt_codeX & rs400("comment")
Rs400.movenext
Loop

'Create a disconnected recordset
Set rs400DTCpt = CreateObject("ADODB.RECORDSET")
rs400DTCpt.Fields.append "CPT", 200, 50 '200=SQL Datatype varchar

rs400DTCpt.CursorType = adOpenStatic
rs400DTCpt.Open
Dim Dt_cpt_codeX
For iW=1 to 12 'or however many you may have -there are 12 possible diag codes in Health Trio
Dt_cpt_codeX= trim(datatable("cptsearchtext" & cstr(iW), dtGlobalSheet))
If len(Dt_cpt_codeX) > 0 then
rs400DTCpt.AddNew "CPT", Dt_cpt_codeX
rs400DTCpt.Update
end if
next

On Error Resume Next

rs400DTCpt.reverse = "CPT"
rs400DTCpt.MoveFirst

On Error Resume Next



Dt_cpt_codeX=""
Do Until rs400DTCpt.EOF
If (dt_cpt_codeX<>"") then
Dt_cpt_codeX=dt_cpt_codeX & ";" ' semi-colon separator
End if
Dt_cpt_codeX=dt_cpt_codeX & rs400DTCpt("CPT")
rs400DTCpt.movenext
Loop




Print dt_cpt_codeX
Print Qnxt_cpt_codeX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top