473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Changing Variable Names

5
OK, I've searched through Google with a mass headache of complicated answers to what I consider a simple problem, that I just cannot get the logic to work out.

I am creating a program where I need to make dynamic variables for game scores. The program is setup to handle multiple leagues, where the number of games in each is different.

I want to setup a ASP script that will create variables by the name of Game1, Game2, Game3, etc. for each game a league may have... then use request.form entries to fill these variables.
Jan 1 '09 #1
4 1703
CroCrew
564 Expert 512MB
Let's see what you have so far. So we know what we have to work with and how we can direct you to your solution.
Jan 2 '09 #2
jhardman
3,406 Expert 2GB
It probably makes sense to do this as an array, right? Then you would have a list of game(0), game(1), game(2) etc. The easiest way to do this on the fly is put the names into single string separated by commas and then use the split() function to assign the values to the array:
Expand|Select|Wrap|Line Numbers
  1. listofgames = "bulls vs rams, bulls vs vikings, bulls vs chiefs"
  2. listofgames = listofgames & ",chiefs vs vikings, chiefs vs rams"
  3. listofgames = listofgames & ",vikings vs rams"
  4. game = split(listofgames, ",")
  5.  
  6. for x = 0 to ubound(game)
  7.    response.write game(x) & "<br>" & vbNewLine
  8. next
Let me know if this points you in the right direction.

Jared
Jan 2 '09 #3
Nicodemas
164 Expert 100+
I like JHardman's idea best, because it makes the most sense. However, I seem to remember once running into a problem, and using an array was not feasible for some reason (ask me why and I'll stare and you dumb-founded).

I made use of the execute() function.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. execute("Game" & intIterator & " = request.querystring(""games"& intInterator &"")"
  3. %>
  4.  
it works on that premise... fill in the blanks for your own script
Jan 2 '09 #4
bwrobo
5
Just wanted to thank you, I had solved the problem on my own without needing dynamic variables, but your solution worked like a charm for some other issues that I was having.

Thanks
Jan 6 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: oom | last post by:
I am a bit of a newbie when it comes to python, when working with lists today I noticed some very odd behaviour, any suggestions welcome: Python 2.2.3 (#1, Nov 6 2003, 14:12:38) on linux2...
3
by: Alex | last post by:
This may sound like a simple question but I really dont' know how to do this. I know you can call a Form Variable in a VBscript using Request.Form("FieldName") and make equal a local variable...
1
by: Ken Fine | last post by:
I have a menu system that has nodes that can be opened or closed. In an effort to make my code more manageable, I programmed a little widget tonight that keeps track of the open/active item and...
4
by: beza1e1 | last post by:
Is it possible compiler.parse a statement, then change and then execute/resolve it? Background: I'm probably to lazy to write my own parser. I have such a statement as string: "distance =...
10
by: Altman | last post by:
I have only done a little programming in C++ so I am still learning but I am having a problem with a variable that is changing on me. I have tried this 2 ways with the same result. I have a...
5
by: Cecilia Bergengruen | last post by:
2 questions: 1)I inserted a menu in an mdi window form. I right clicked on a menu item and pressed edit names. I therefore edited all my menu item names. Then I right clicked and pressed edit...
2
by: celtique | last post by:
Hello everybody! I've just registered to this forum and yet got a question. :) I've got some database, that is processed by PHP in a 'while' loop and each element that the loop draws (<li>) gets...
4
by: Mikael Olofsson | last post by:
Hi! This is in Python 2.3.4 under WinXP. I have a situation where I think changing the behaviour of a namespace would be very nice. The goal is to be able to run a python file from another in...
2
by: physicslad | last post by:
Hi, I have in my program a list of lists of variables. These variables change as the program runs. I would like to be able to link meaningful names to the variables. So, say I have a list of...
1
by: viceyo | last post by:
Hi! I'm new to Javascript and I'm trying to write a script in which I need to use diferent variable names. The names are used from here: <img border="0" alt="Visit W3Schools!"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.