Jump to content
WAPT Forum
Sign in to follow this  
Guest cirej2000

Problems with If/then statements using initial variables

Recommended Posts

Guest cirej2000

I'm having a big problem with using initial variables.

First of all the initial variable I'm using is a ordered list from a file (this now works great, thanks!).

The goal of my script is to load the URL from a file and use that url in a request.

 

The script loads the next url in sequence with no problems.

 

Here's the problem:

 

My goal is to, based on the action type specified in the URL, go to a particular location in an if/then block.

 

So, if I load the url into a variable, $VAR(Fileurl), I want to be able to go to a certain block in the code

 

if $VAR(Fileurl) contains "hook"

GET_HookRequest

else if $VAR(Fileurl) contains "hover"

GET_HoverRequest

else if $VAR(Fileurl) contains "addtocart"

GET_CartRequest

else

GET_UnknownRequest

endif

 

There is no reliable processing in the if then else block.

 

I've tried to also use a javascript block to parse the value in the $VAR(Fileurl) and if the url has an index > 0 for one of the values (hook, hover, addtocart, unknown) then return a value (1,2,3,4) corresponding to that value. Then using the if them block:

 

if javascriptval=1

GET_HookRequest

else javascriptval=2

GET_HoverRequest

else javascriptval=3

GET_CartRequest

else

GET_UnknownRequest

endif

 

 

This does not work either.

 

 

Is this a problem with recognizing and using initial variables against other initial variables? Without a way to process the initial variables prior to the request blocks, it severely limits the usage of initial variables in decision making logic. This would limit making decisions based on a user/login, customer code, random value, etc.

 

Maybe I'm doing something wrong. I'm emailing the profile file for the javascript example above.

 

The non javascript example simply attempts to use the $Var(FileURL) value directly in the if/then statements.

 

 

Share this post


Link to post
Share on other sites
So, if I load the url into a variable, $VAR(Fileurl), I want to be able to go to a certain block in the code

 

if $VAR(Fileurl) contains "hook"

GET_HookRequest

else if $VAR(Fileurl) contains "hover"

GET_HoverRequest

else if $VAR(Fileurl) contains "addtocart"

GET_CartRequest

else

GET_UnknownRequest

endif

 

There is no reliable processing in the if then else block.

 

This is a bug. We are fixing it.

Share this post


Link to post
Share on other sites
Guest cirej2000
This is a bug. We are fixing it.

Right on! You guys rock!

 

Thanks, Sergei.

Share this post


Link to post
Share on other sites
Guest cirej2000

Hi Sergei,

 

I've noticed a couple of issues with this release:

 

1) The Tools->Settings dialog will lose tabs as you click from one tab to the next. It goes from 7 to 2 tabs (with the general and Record tabs being the only ones remaining).

 

2) On the Initial Variables dialog, there is a problem with the ability to add a new variable. When I created my first two variables, I don't recall having a problem. And it seems as though if I attempt to create a variable right after starting WAPT Pro, things work fine. That being said, anytime during a session of WAPT Pro after the first attempt to create variable encounters a problem with the "Add" button on the "Add Variable" dialog. It does nothing after the first attempt during that run of WAPT Pro.

 

...

 

I now can no longer reproduce this issue after doing so a couple of times. I'll keep an eye open for the issue. Not sure if the settings menu was a side effect of the Initial Variable thing, vice-versa or if the two were unrelated. But they definitely occurred and were reproducible.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×