![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#3
| |||
| |||
|
|
What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#4
| |||
| |||
|
|
I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#5
| |||
| |||
|
|
Check the value of DialCode before you pass it in. -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:%23KO8q5ReDHA.3076 (AT) TK2MSFTNGP11 (DOT) phx.gbl... I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#6
| |||
| |||
|
|
in the paticular instance thats tripping up the whole thing it has 01472 in it (a UK dialing code) - this isnt in the table so it just seems to grind to a halt there it works fine for mobile and international numbers basically which is what we need but UK dialing codes are in not in the Dial table "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uWL9l8ReDHA.1820 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Check the value of DialCode before you pass it in. -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:%23KO8q5ReDHA.3076 (AT) TK2MSFTNGP11 (DOT) phx.gbl... I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#7
| |||
| |||
|
|
What is the error it gives exactly? Turn logging on If I tested using this CREATE TABLE Source(SourceCode varchar(50) CREATE TABLE Lookup(ID INT Primary key IDENTITY(1,1), LookupVal varchar(50)) In the lookup I would Pass in SourceCode looking for ID Would that be a valid test ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:u5rT$BSeDHA.3096 (AT) TK2MSFTNGP11 (DOT) phx.gbl... in the paticular instance thats tripping up the whole thing it has 01472 in it (a UK dialing code) - this isnt in the table so it just seems to grind to a halt there it works fine for mobile and international numbers basically which is what we need but UK dialing codes are in not in the Dial table "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uWL9l8ReDHA.1820 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Check the value of DialCode before you pass it in. -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:%23KO8q5ReDHA.3076 (AT) TK2MSFTNGP11 (DOT) phx.gbl... I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#8
| |||
| |||
|
|
i'm sorry i'm not sure what that code means - i've never used sql before - my background is in PC Desktop Support i've only ever created tables in enterprise manager if it helps i could give you a list of the fields and data types in each of the two tables? "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uD%23h%23TSeDHA.1908 (AT) TK2MSFTNGP12 (DOT) phx.gbl... What is the error it gives exactly? Turn logging on If I tested using this CREATE TABLE Source(SourceCode varchar(50) CREATE TABLE Lookup(ID INT Primary key IDENTITY(1,1), LookupVal varchar(50)) In the lookup I would Pass in SourceCode looking for ID Would that be a valid test ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:u5rT$BSeDHA.3096 (AT) TK2MSFTNGP11 (DOT) phx.gbl... in the paticular instance thats tripping up the whole thing it has 01472 in it (a UK dialing code) - this isnt in the table so it just seems to grind to a halt there it works fine for mobile and international numbers basically which is what we need but UK dialing codes are in not in the Dial table "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uWL9l8ReDHA.1820 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Check the value of DialCode before you pass it in. -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:%23KO8q5ReDHA.3076 (AT) TK2MSFTNGP11 (DOT) phx.gbl... I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
#9
| |||
| |||
|
|
Ok that would be good. Also give me same data that you expect in each table (Enough to make it fail). You do not need to give me the whole table def only the relevant columns -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:OeL8NwSeDHA.616 (AT) TK2MSFTNGP11 (DOT) phx.gbl... i'm sorry i'm not sure what that code means - i've never used sql before - my background is in PC Desktop Support i've only ever created tables in enterprise manager if it helps i could give you a list of the fields and data types in each of the two tables? "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uD%23h%23TSeDHA.1908 (AT) TK2MSFTNGP12 (DOT) phx.gbl... What is the error it gives exactly? Turn logging on If I tested using this CREATE TABLE Source(SourceCode varchar(50) CREATE TABLE Lookup(ID INT Primary key IDENTITY(1,1), LookupVal varchar(50)) In the lookup I would Pass in SourceCode looking for ID Would that be a valid test ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:u5rT$BSeDHA.3096 (AT) TK2MSFTNGP11 (DOT) phx.gbl... in the paticular instance thats tripping up the whole thing it has 01472 in it (a UK dialing code) - this isnt in the table so it just seems to grind to a halt there it works fine for mobile and international numbers basically which is what we need but UK dialing codes are in not in the Dial table "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:uWL9l8ReDHA.1820 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Check the value of DialCode before you pass it in. -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:%23KO8q5ReDHA.3076 (AT) TK2MSFTNGP11 (DOT) phx.gbl... I Expect that would work except the package crashes out when it tries to look for data to put into the array - as soon as it performs the lookup "DTSLookups("NumDetails").Execute(DialCode)" it halts with an error message - but all the rows before the one that it cant find in the "Dial" table work fine "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:u7eJ9wReDHA.736 (AT) TK2MSFTNGP11 (DOT) phx.gbl... What about checking for if the array ISEMPTY() ? -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Adept Systems (Hull) Ltd" <JamesB (AT) adept-systems (DOT) co.uk> wrote in message news:ejzYghReDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl... Visual Basic Transformation Script I'm having a problem with the code below in a DTS Transformation. It works fine with any numbers that are in the "Dial" table that it references - but if the dialing code is not there, and the telephone number is valid it bombs out. Ideally i would like it to put "unknown" in the description and move on to the next row Is there any way to do this? I appologise in advance if this is something simple! Option Explicit Function Main() Dim DialCode Dim FirstDigit Dim SecDigit Dim arrNumStuff FirstDigit = Left( DTSSource("ClipNumber") , 1) SecDigit = Mid( DTSSource("ClipNumber") , 2 , 1 ) DTSDestination("Called Number") = DTSSource("ClipNumber") If DTSSource("Flag") = "O " then If FirstDigit = 0 And SecDigit <> 0 then DialCode = Left( DTSSource("ClipNumber") , 5 ) arrNumStuff = DTSLookups("NumDetails").Execute(DialCode) DTSDestination("Call type") = arrNumStuff(0) DTSDestination("Description") = arrNumstuff(1) Else DTSDestination("Call type") = Null DTSDestination("Description") = "Local or Speaking Clock" End If Else DTSDestination("Call type") = Null DTSDestination("Description") = Null End If Main = DTSTransformStat_OK End Function The Lookup it references is as follows: SELECT [Call Type], Destination FROM Dial WHERE ([Dialled String] = ?) |
![]() |
| Thread Tools | |
| Display Modes | |
| |