PDA

View Full Version : Lenny! Array brickwall!!


ABC123

burtnco
09-21-2004, 03:07 AM
Hi, folks.

I’m still attempting to convert our web store from Webfiler to Alpha Five. Most of it is very straightforward. But I’ve run into a roadblock involving arrays, and I could use your assistance. I’ve been at the same piece of code for three days and keep coming back to the same brick wall.

To see how the WAS version should work, please visit the Webfiler edition of www.burtnco.com. Enter the store. Click the Search link in the left column. Then work the page so the grid on the following page populates. Next, choose a few things on that page and press the Submit button, which populates your to cart. The End. No problems. The results page form submits the checked items (var-"box(var-"line)): a7=item code A, a16=item code B, a23=item code C) to the script page. The script page, not knowing which of the 37 items presented in the search results were checked by the user, loops through a1 to a37, scanning each possibility to weed out the nulls. As each non-null is encountered, that item is translated and added to the cart. When eof() is encountered, the cart page loads. (Webfiler doesn’t use arrays; it uses nested variables [(var-"box(var-"line)) = item code] to do the trick.)

Well, the weeding of the nulls is the point at which the WAS version won’t work properly. The search "forms" work perfectly. The results grid populates perfectly. The check boxes are named and designated properly. And the submit button sends the checked variables (a[7], a[26], a[23]) to the cart page just fine. But the cart page won’t read the array right. Unless the first item in the array is a[1], some or all of the elements in the array aren’t seen. In some cases, the scan of the array quits after only 3 or 4 cycles, even though number 12 might be checked and the variable is listed in the “get” statement of the raw log.

I’ve tried to duplicate the looping cycle used in Webfiler this way: I’ve named the check box variables without the array brackets: a1,a2,a3… But to cycle through them searching for non-nulls with for-to-next or while or until statements, needing a dimmed variable to look at, the script thinks that the variable I contains the string “a1” instead of the contents of the variable a1. So this method is out.

When I use the array approach, without the eval_valid(“a[line]”) statement in the loop, all variables are deemed “out-of-bounds.” I think the eval_valid() is the culprit. But I can’t debug the script properly, looking at each line’s influence on the script’s performance and the variable’s contents, since I can’t load the page into the WAS debugger: it automatically strips everything from "body" downward out of the page!!

I’d like you take a look at the http://68.167.39.100/buyfromchkbox.txt and http://68.167.39.100/resultsgrid.txt files and try to help me solve this. Most of the site is made up of checkbox order forms because the clients we’re looking for should be able to purchase multiple items from the same page in an efficient manner. I need to make the buyfromchkbox.a5w script page work just like its grandfather page does in Webfiler.

The pages that these files pertain to begin at http://68.167.39.100/search.a5w The site will be active 24/7 until I get this operational. The log files are at http://68.167.39.100/A5Wlog/ should they be needed.

Call me for any clarificaton. I'm here from 8-6 NY time. Thanks for your help!

--Burt
856-983-6004

Selwyn Rabins
09-21-2004, 07:29 AM
i have to be honest, i did not read your entire message. however, one line did pop out when i scanned the message.

you have:

eval_valid("a[line]")

presumably 'line' is a numeric varible.

say line has a value of 5

it is valid to write

eval_valid("a[5]")

but it is not valid to write

eval_valid("a[line]")

you have to write

eval_valid("a[" + line + "]")

that's because

"a[" + line + "]"

evaluates to

a[5]

burtnco
09-21-2004, 08:28 AM
Thanks, Selwyn. I'll fix the evalution line this p.m.

By the way, folks, I just found that I had left and "end" statement and a nonexistant variable on the the buyfromchkbox.a5w page that precluded you from seeing the whole page. That's fixed now. If you've tried to look before, please try again now.

--Burt

burtnco
09-29-2004, 11:04 AM
This problem has been fixed.

--Burt