Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

vb script select statement

What is wrong with this statement?

Function (Amort_Type)
 select case
   case 1: Fixed
   case 2: ARM
   case 3: GPM
   case 4: Other
  end select
end function

Function L_AmortizationType
 L_AmortizationType=select (Amort_Type)
end Function
0
tarakwar101
Asked:
tarakwar101
  • 4
  • 3
1 Solution
 
bruintjeCommented:
Hello tarakwar101,

you are missing a function name
----------
Function (Amort_Type)
 select case
   case 1: Fixed
   case 2: ARM
   case 3: GPM
   case 4: Other
  end select
end function

Function L_AmortizationType
 L_AmortizationType=select (Amort_Type) 'this will not work because select is not declared
end Function
----------

this will go better
----------
Function Select(Amort_Type)
 select case
   case 1: Fixed
   case 2: ARM
   case 3: GPM
   case 4: Other
  end select
end function

Function L_AmortizationType
 L_AmortizationType= Select(Amort_Type)
end Function
----------

hope this helps a bit
bruintje
0
 
tarakwar101Author Commented:
getting syntax error when I run script, from the function select(Amort_Type) line 25,10
0
 
bruintjeCommented:
had to test it

msgbox L_AmortizationType(4)

Function Amort_Type(TypeId)
select case TypeId
   case 1: Amort_Type="Fixed"

   case 2: Amort_Type="ARM"
   case 3: Amort_Type="GPM"
   case 4: Amort_Type="Other"
  end select
end function

Function L_AmortizationType(LoanType)
 L_AmortizationType= Amort_Type(LoanType)
end Function
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
tarakwar101Author Commented:
Still getting error, I think if I explain better it might help. I have a script that checks the values in an xml database, the xml database has values in it from another program, the script is called from inside our program. I have been able to get the other values to pull in but having issue with this one.
so I should be able to do this:

Function Amort_Type(TypeId)
select case TypeId
   case 1: Amort_Type="Fixed"
   case 2: Amort_Type="ARM"
   case 3: Amort_Type="GPM"
   case 4: Amort_Type="Other"
  end select
end function

Function L_AmortizationType(LoanType)
 L_AmortizationType= Amort_Type("Loan/AmortizationType")
end Function

Here is what I have that works:

function GetX(Name, Instance)
  GetX = ""
  node = xmld.GetElementsByTagName(Name)
  if node.length > 0 then
    GetX = node.item(instance).text
  end if
end function

Function Borrower_Name
 Borrower_Name=GetX("Borrower/Name",0)
end Function

and here is part of the xml doc values:
<Borrower>
<BorrowerID>1</BorrowerID>
      <Name>harry</tName>
      <MiddleName>frick'n</MiddleName>
      <LastName>winchester</LastName>
      <HomePhone>3455555555</HomePhone>
      <MobilePhone>4255555555</MobilePhone>
      <Fax>3455555555</Fax>
      <Age>42</Age>
      <DOB>10/13/1963</DOB>
      <Gender>2</Gender>
      <AmortizationType>3</AmortizationType>
      <YearsSchool>16</YearsSchool>
      <MaritalStatus>1</MaritalStatus>


0
 
bruintjeCommented:
what i don't understand is what this line is doing

L_AmortizationType= Amort_Type("Loan/AmortizationType")

it is passing in a string? i think that should be a node value from your xml document

this is just guessing but it looks like you need something as

Function L_AmortizationType()
  node = xmld.GetElementsByTagName("Loan/AmortizationType")
  if node.length > 0 then
    GetX = node.item(instance).text
  end if
  L_AmortizationType= Amort_Type(GetX)
end Function
0
 
tarakwar101Author Commented:
Got it to work! What I doing was not putting in the GetX then the values.
The Loan/AmortizationType is   Loan<--table   AmortizationType <--row
Your code above is what steared me in right direction Thanks.

function AmortizationType
 select case GetX("Loan/AmortizationType",0)
    case 1 AmortizationType="Fixed"
    case 2 AmortizationType="ARM"
    case 3 AmortizationType="GPM"
    case 4 AmortizationType="Other"
   end select
end function

Function L_AmortizationType
 L_AmortizationType=AmortizationType
end Function
0
 
bruintjeCommented:
glad it works now, took me also some time to figure out what really was needed ;-)
thanks for the grade
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now