p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Variable creation


Message #1 by gbrown@c... on Wed, 28 Nov 2001 14:44:03
This is a multi-part message in MIME format.

------=_NextPart_000_002C_01C178A1.439F36A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

RE: [proasp_codeclinic] Variable creationYou might look into dictionary
objects.  They allow you to add objects to the dictionary that can have a
key(name) and data.  The data can be simple data or an array.

  -----Original Message-----
  From: David Cameron [mailto:dcameron@i...]
  Sent: Wednesday, November 28, 2001 5:37 PM
  To: Code Clinic
  Subject: [proasp_codeclinic] RE: Variable creation


  AFAIK this cannot be done.

  Write an array with enough dimensions to deal with it. eg

  MyArray(100, 2)

  MyArray(0,0) = array_name(0)
  MyArray(0,1) = array_name(1)

  End up with an array like:

  [CUSTOMER_NAME, ABC LIMITED
   CONTACT_NAME, FRED
   MyVal, This]

  etc.

  I might have the dimensions wrong in this one, but you get the idea.

  regards
  David Cameron
  nOw.b2b
  dcameron@i...

  -----Original Message-----
  From: gbrown@c... [mailto:gbrown@c...]
  Sent: Thursday, 29 November 2001 12:44 AM
  To: Code Clinic
  Subject: [proasp_codeclinic] Variable creation



  Hi all

  I've got a text file which contains definitions like:-

  "CUSTOMER_NAME=ABC LIMITED"
  "CONTACT_NAME=FRED"

  At the moment my code does a split on the equals sign for each row in the
  text file. As I know what variables I am expecting I then do

  select case array_name(0)
  case "CUSTOMER_NAME"
     customer_name=array_name(1)
  case "CONTACT_NAME"
     contact_name=array_name(1)
  end select

  I can't rely on knowing what variables I am receiving though so I am
  trying to work out the vbscript syntax to be able to assign the variables
  on the fly.

  In other languages I can do something &array_name(0).=array_name(1), this
  is referred to as macro expansion.

  Could anyone assist with the syntax in VBScript?

  Thanks
  Regards
  Graham



dcameron@i...
$subst('Email.Unsub')

  Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid
=rn_ebooks


jparlato@m...
$subst('Email.Unsub')
  Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid
=rn_ebooks



  Return to Index