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
tarakwar101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.