This content has been marked as final. Show 4 replies
-- here's where I'm not sure...
put "<TD>" & gDatabase.getPropAt(i) & "</TD>" after htext
put "<TD>" & gDatabase[gDatabase.getPropAt(i)] & "</TD>" after htext
By the way, as long as you will never need to store any other data about
users (other than their password) your design will be fine. If there is any
chance that you will want to add something later you may want to go ahead
and prepare for that now, so that you won't have to as much modification
So for example, suppose you wanted to assign eahc user to a specific group
(like guest, superuser,admin, etc) and also wanted to track when any user
info was updated.
gDatabase = [#bwillis: [#password:"bruce", #permissions:"administrator",
Thanks Dave. That works a treat.
I'm still not too sure about how the second line in your solution works. Is that line retrieving and displaying the value (password)? If so, how?
I understand your point in your second post - hence my recent posts about nested lists.
The amount of beers I owe you for your help is steadily climbing.
Thanks again Dave.
If the list looks like this gDatabase = [#bwillis: "bruce", #vdiesel:
"vin", #bpitt: "brad", #wallen:
"woody"] then in the repeat loop when i = 1 the expression
gDatabase.getPropAt(i) returns #bwillis" (a symbol). When you append a
symbol to a string Director you get a string (I assume this is by design and
not a fluke). In this case you are appending the <TD> tags, so it works. As
good practice, you may want to use the string function to force Director to
treat objects as a string when so desired.
The next line uses the same expression, but because it is not being appended
to a string (in the order things get executed), it remains a symbol.
gDatabase[gDatabase.getPropAt(i)] > gDatabase[#bwillis] > "bruce"
It is after this that it gets appended to the <TD> tags. So with each pass
of the loop, you get the associated password.
If you decide you will need to define multiple properties, you can adjust
the code to match.
put "<TD>" & gDatabase.getPropAt(i).password] & "</TD>" after htext
put "<TD>" & gDatabase[gDatabase.getPropAt(i).password] & "</TD>" after
Now you can add as many properties to the user as your program needs.
I have only had the pleasure of sampling the Americanized version of beer,
my favorite being Guinness.