Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

SelectNode[s] method, comma breaks string

$
0
0
Hi All, I'm using a vendor supplied script to run a function I made to swap values in 2 XML strings. When I run it and the attribute values have commas it doesn't load the entire string and breaks it at the first comma and thus not returning a value at the SelectNodes method. If the String doesn't contain commas the function works fine. it looks like the script delimits parameters at the comma. I cant change the vendor supplied code as its validated so can only modify the user defined function. So close.

function UpdateContainerLotCode (containersXmlString, lotCodeXmlString)

dim containersXml
dim lotCodeXml
dim numContainers
dim currentBarcode
dim invLotCode
Set containersXml = CreateObject("msxml2.DOMDocument.4.0")
Set lotCodeXml = CreateObject("msxml2.DOMDocument.4.0")
containersXml.loadxml(containersXmlString)


'foreach container in the container xml update the lotCode

numContainers = containersXml.selectNodes("//IdentifiedContainer").length

if (numContainers > 1 ) Then
lotCodeXml.loadxml(lotCodeXmlString)
else
invLotCode = lotCodeXmlString
end if

for container = 1 to numContainers

currentBarcode = containersXml.selectSingleNode("//IdentifiedContainer[" & container & "]/@BarcodeValue").value

if (numContainers > 1) Then
invLotCode = lotCodeXml.selectSingleNode("//Container[@barcode='" & currentBarcode & "']/@lotCode").value
End If
containersXml.selectSingleNode("//IdentifiedContainer[" & container & "]/@LotCode").value = invLotCode
Next

UpdateContainerLotCode = replace(containersXml.xml, """", "'")

end function

'containersXmlString:
<Containers><IdentifiedContainer ID='{2BC77605-5C9B-49E1-B619-3A1DF7AC6746}' VersionNo='1'

LotUID='{14E64F7D-86CE-47C6-B09C-DB7DE790FC5C}' LotVersionNo='1' LotCode='CS334-16OCT-001'

BarcodeValue='-DC4C297F97D5F4$' ContainerNumber='1' SampleContainerTF='False' MaterialUID='{D33151B0-

C08D-4807-9A72-162CAE5C2419}' MaterialVersionNo='3' MaterialCode='I40018' MaterialDesc='CORNING 1

LITER DISPOSABLE ERLENMEYER FLASK, PLUG SEAL CAP' Quantity='20.00' UOMUID='{D3C84487-B091-478B-89C9-

FE9F4B5FD795}' UOMVersionNo='3' UOMShortDesc='EA' UOMDesc='Eaches' StatusUID='1' StatusVersionNo=''

StatusShortDesc='Accept' StatusDesc='QC Accepted' LocationUID='{22407B86-65DB-4119-A90E-D768FF7DB9E5}'

LocationVersionNo='' LocationShortDesc='RM131' LocationDesc='Room_131' LastReviewDate='2014-10-

14T16:22:25' NextReviewDate='2014-11-15T23:59:59.690000000' NextRetestDate='2014-11-

15T23:59:59.690000000' Potency='100.00000000' SpecificGravity='1.00000000' VesselTypeUID='{CF49B37F-

CC99-4019-8339-EC9C54CBF085}' VesselTypeVersionNo='2' VesselTypeShortDesc='PlasticWeigh'

VesselTypeDesc='Plastic Weigh Container' OrderUID='{172B92D2-B040-4641-BBAC-F1E05C14BC3F}'

ComponentUID='{604DA117-9EAB-4D81-9F92-26882CF79881}' OrderNumber='CS334-16OCT-001'

ProductUID='{CF8ADFCC-BE59-4A18-B09E-4CD937DEAEA7}' ProductVersionNo='3' ProductCode='SOL334'

ProductDesc='RECD-5174 @ BI2 COMMON 1M SODIUM CHLORIDE' PhaseUID='{F546C817-D8D5-487A-96DB-

8A7470819F50}' PhaseVersionNo='1' PhaseShortDesc='AutoWD' PhaseDesc='AutoWD' PalletUID=''

PalletVersionNo='' PalletBarcode='' PalletNumber='' ContainerTypeID='4' ContainerTypeShortDesc='Dsp'

ContainerTypeDesc='Dispense' ContainerVerifiedTF='True' VerifiedUser='op1 (op1)'

Status='dispensed'><StorageClassifications ID='D33151B0-C08D-4807-9A72-

162CAE5C2419'><StorageClassification ID='6BE34425-F49B-4A45-AD1B-74732B361F3D' VersionNo='4'

ShortDesc='AMBIENT' Desc='Ambient'/></StorageClassifications></IdentifiedContainer><IdentifiedContainer

ID='{C6FB8CDE-1EFB-42E7-96E6-8B071098FEC0}' VersionNo='2' LotUID='{14E64F7D-86CE-47C6-B09C-

DB7DE790FC5C}' LotVersionNo='1' LotCode='CS334-16OCT-001' BarcodeValue='-DEC17C1FDBE554$'

ContainerNumber='2' SampleContainerTF='False' MaterialUID='{D33151B0-C08D-4807-9A72-162CAE5C2419}'

MaterialVersionNo='3' MaterialCode='I40018' MaterialDesc='CORNING 1 LITER DISPOSABLE ERLENMEYER FLASK,

PLUG SEAL CAP' Quantity='5.00' UOMUID='{D3C84487-B091-478B-89C9-FE9F4B5FD795}' UOMVersionNo='3'

UOMShortDesc='EA' UOMDesc='Eaches' StatusUID='1' StatusVersionNo='' StatusShortDesc='Accept' StatusDesc='QC

Accepted' LocationUID='{22407B86-65DB-4119-A90E-D768FF7DB9E5}' LocationVersionNo=''

LocationShortDesc='RM131' LocationDesc='Room_131' LastReviewDate='2014-10-14T16:22:25'

NextReviewDate='2014-11-15T23:59:59.280000000' NextRetestDate='2014-11-15T23:59:59.280000000'

Potency='100.00000000' SpecificGravity='1.00000000' VesselTypeUID='{CF49B37F-CC99-4019-8339-

EC9C54CBF085}' VesselTypeVersionNo='2' VesselTypeShortDesc='PlasticWeigh' VesselTypeDesc='Plastic Weigh

Container' OrderUID='{172B92D2-B040-4641-BBAC-F1E05C14BC3F}' ComponentUID='{604DA117-9EAB-4D81-

9F92-26882CF79881}' OrderNumber='CS334-16OCT-001' ProductUID='{CF8ADFCC-BE59-4A18-B09E-

4CD937DEAEA7}' ProductVersionNo='3' ProductCode='SOL334' ProductDesc='RECD-5174 @ BI2 COMMON 1M

SODIUM CHLORIDE' PhaseUID='{F546C817-D8D5-487A-96DB-8A7470819F50}' PhaseVersionNo='1'

PhaseShortDesc='AutoWD' PhaseDesc='AutoWD' PalletUID='' PalletVersionNo='' PalletBarcode='' PalletNumber=''

ContainerTypeID='4' ContainerTypeShortDesc='Dsp' ContainerTypeDesc='Dispense' ContainerVerifiedTF='True'

VerifiedUser='op1 (op1)' Status='dispensed'><StorageClassifications ID='D33151B0-C08D-4807-9A72-

162CAE5C2419'><StorageClassification ID='6BE34425-F49B-4A45-AD1B-74732B361F3D' VersionNo='4'

ShortDesc='AMBIENT' Desc='Ambient'/></StorageClassifications></IdentifiedContainer><IdentifiedContainer

ID='{962B3B7D-5603-4E65-B610-6DDE4FE54D4B}' VersionNo='2' LotUID='{14E64F7D-86CE-47C6-B09C-

DB7DE790FC5C}' LotVersionNo='1' LotCode='CS334-16OCT-001' BarcodeValue='-D558C60A633954$'

ContainerNumber='3' SampleContainerTF='False' MaterialUID='{D33151B0-C08D-4807-9A72-162CAE5C2419}'

MaterialVersionNo='3' MaterialCode='I40018' MaterialDesc='CORNING 1 LITER DISPOSABLE ERLENMEYER FLASK,

PLUG SEAL CAP' Quantity='5.00' UOMUID='{D3C84487-B091-478B-89C9-FE9F4B5FD795}' UOMVersionNo='3'

UOMShortDesc='EA' UOMDesc='Eaches' StatusUID='1' StatusVersionNo='' StatusShortDesc='Accept' StatusDesc='QC

Accepted' LocationUID='{22407B86-65DB-4119-A90E-D768FF7DB9E5}' LocationVersionNo=''

LocationShortDesc='RM131' LocationDesc='Room_131' LastReviewDate='2014-10-14T16:22:25'

NextReviewDate='2014-11-15T23:59:59.293000000' NextRetestDate='2014-11-15T23:59:59.293000000'

Potency='100.00000000' SpecificGravity='1.00000000' VesselTypeUID='{CF49B37F-CC99-4019-8339-

EC9C54CBF085}' VesselTypeVersionNo='2' VesselTypeShortDesc='PlasticWeigh' VesselTypeDesc='Plastic Weigh

Container' OrderUID='{172B92D2-B040-4641-BBAC-F1E05C14BC3F}' ComponentUID='{604DA117-9EAB-4D81-

9F92-26882CF79881}' OrderNumber='CS334-16OCT-001' ProductUID='{CF8ADFCC-BE59-4A18-B09E-

4CD937DEAEA7}' ProductVersionNo='3' ProductCode='SOL334' ProductDesc='RECD-5174 @ BI2 COMMON 1M

SODIUM CHLORIDE' PhaseUID='{F546C817-D8D5-487A-96DB-8A7470819F50}' PhaseVersionNo='1'

PhaseShortDesc='AutoWD' PhaseDesc='AutoWD' PalletUID='' PalletVersionNo='' PalletBarcode='' PalletNumber=''

ContainerTypeID='4' ContainerTypeShortDesc='Dsp' ContainerTypeDesc='Dispense' ContainerVerifiedTF='True'

VerifiedUser='op1 (op1)' Status='dispensed'><StorageClassifications ID='D33151B0-C08D-4807-9A72-

162CAE5C2419'><StorageClassification ID='6BE34425-F49B-4A45-AD1B-74732B361F3D' VersionNo='4'

ShortDesc='AMBIENT' Desc='Ambient'/></StorageClassifications></IdentifiedContainer><IdentifiedContainer

ID='{17B7973A-A595-4BB8-B06A-77F480A85C6B}' VersionNo='1' LotUID='{3893AB10-341F-4948-AB1D-

C63A20B610A8}' LotVersionNo='1' LotCode='CS334-16OCT-001' BarcodeValue='-DF7E28006CF634$'

ContainerNumber='1' SampleContainerTF='False' MaterialUID='{45833379-D3AA-4DAE-AE93-F650E01E8331}'

MaterialVersionNo='4' MaterialCode='I15609' MaterialDesc='FILTER,OPTICAP DURAPORE HYDROPHOBIC FILTERS

0.22 UM RATED' Quantity='1.00' UOMUID='{D3C84487-B091-478B-89C9-FE9F4B5FD795}' UOMVersionNo='3'

UOMShortDesc='EA' UOMDesc='Eaches' StatusUID='1' StatusVersionNo='' StatusShortDesc='Accept' StatusDesc='QC

Accepted' LocationUID='{22407B86-65DB-4119-A90E-D768FF7DB9E5}' LocationVersionNo=''

LocationShortDesc='RM131' LocationDesc='Room_131' LastReviewDate='2012-12-01T15:51:40'

NextReviewDate='2014-11-15T23:59:59.953000000' NextRetestDate='2014-11-15T23:59:59.953000000'

Potency='100.00000000' SpecificGravity='1.00000000' VesselTypeUID='{CF49B37F-CC99-4019-8339-

EC9C54CBF085}' VesselTypeVersionNo='2' VesselTypeShortDesc='PlasticWeigh' VesselTypeDesc='Plastic Weigh

Container' OrderUID='{172B92D2-B040-4641-BBAC-F1E05C14BC3F}' ComponentUID='{BEFFEBB7-843C-4D63-

BDB7-5408C74BFF33}' OrderNumber='CS334-16OCT-001' ProductUID='{CF8ADFCC-BE59-4A18-B09E-

4CD937DEAEA7}' ProductVersionNo='3' ProductCode='SOL334' ProductDesc='RECD-5174 @ BI2 COMMON 1M

SODIUM CHLORIDE' PhaseUID='{F546C817-D8D5-487A-96DB-8A7470819F50}' PhaseVersionNo='1'

PhaseShortDesc='AutoWD' PhaseDesc='AutoWD' PalletUID='' PalletVersionNo='' PalletBarcode='' PalletNumber=''

ContainerTypeID='4' ContainerTypeShortDesc='Dsp' ContainerTypeDesc='Dispense' ContainerVerifiedTF='True'

VerifiedUser='op2 (op2)' Status='dispensed'><StorageClassifications ID='45833379-D3AA-4DAE-AE93-

F650E01E8331'><StorageClassification ID='6BE34425-F49B-4A45-AD1B-74732B361F3D' VersionNo='4'

ShortDesc='AMBIENT' Desc='Ambient'/></StorageClassifications></IdentifiedContainer><IdentifiedContainer

ID='{0CF3540A-4FC4-439B-A019-8E954CFA3B7A}' VersionNo='1' LotUID='{506D42FA-DDB9-4503-B3F4-

E798699BD2D0}' LotVersionNo='1' LotCode='CS334-16OCT-001' BarcodeValue='-D94ACBB8D680F4$'

ContainerNumber='1' SampleContainerTF='False' MaterialUID='{13FE7082-631C-40A4-B0B4-78FC007D1DBF}'

MaterialVersionNo='1' MaterialCode='I10039' MaterialDesc='TUBING ASSEMBLY, Y-BRANCH WITH MALE AND

FEMALE PALL KLEENPAK CONNECTOR' Quantity='1.00' UOMUID='{D3C84487-B091-478B-89C9-FE9F4B5FD795}'

UOMVersionNo='3' UOMShortDesc='EA' UOMDesc='Eaches' StatusUID='1' StatusVersionNo=''

StatusShortDesc='Accept' StatusDesc='QC Accepted' LocationUID='{22407B86-65DB-4119-A90E-D768FF7DB9E5}'

LocationVersionNo='' LocationShortDesc='RM131' LocationDesc='Room_131' LastReviewDate='2014-10-

14T16:20:51' NextReviewDate='2014-11-21T23:59:59.557000000' NextRetestDate='2014-11-

21T23:59:59.557000000' Potency='100.00000000' SpecificGravity='1.00000000' VesselTypeUID='{CF49B37F-

CC99-4019-8339-EC9C54CBF085}' VesselTypeVersionNo='2' VesselTypeShortDesc='PlasticWeigh'

VesselTypeDesc='Plastic Weigh Container' OrderUID='{172B92D2-B040-4641-BBAC-F1E05C14BC3F}'

ComponentUID='{CAFEEF4D-B2D2-445B-90CB-04A7EABE89A2}' OrderNumber='CS334-16OCT-001'

ProductUID='{CF8ADFCC-BE59-4A18-B09E-4CD937DEAEA7}' ProductVersionNo='3' ProductCode='SOL334'

ProductDesc='RECD-5174 @ BI2 COMMON 1M SODIUM CHLORIDE' PhaseUID='{F546C817-D8D5-487A-96DB-

8A7470819F50}' PhaseVersionNo='1' PhaseShortDesc='AutoWD' PhaseDesc='AutoWD' PalletUID=''

PalletVersionNo='' PalletBarcode='' PalletNumber='' ContainerTypeID='4' ContainerTypeShortDesc='Dsp'

ContainerTypeDesc='Dispense' ContainerVerifiedTF='True' VerifiedUser='op2 (op2)'

Status='dispensed'><StorageClassifications ID='13FE7082-631C-40A4-B0B4-

78FC007D1DBF'><StorageClassification ID='6BE34425-F49B-4A45-AD1B-74732B361F3D' VersionNo='4'

ShortDesc='AMBIENT' Desc='Ambient'/></StorageClassifications></IdentifiedContainer></Containers>

'lotCodeXmlString:
<Containers><Container barcode='-DC4C297F97D5F4$' lotCode = 'C44616' /><Container barcode='-

DEC17C1FDBE554$' lotCode = 'C44616' /><Container barcode='-D558C60A633954$' lotCode = 'C44616'

/><Container barcode='-DF7E28006CF634$' lotCode = 'C43898' /><Container barcode='-D94ACBB8D680F4$'

lotCode = 'C45506' /></Containers>
Attached Files

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>