CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 ASP & CC Help with Variables

Print topic Send  topic

Author Message
Anthony Trotter
Posted: 05/30/2001, 12:52 AM

Anyone - PLEASE help!

I have an affiliate program registration form that I am working on.
If a person joing our affiliate program was not referred by anyone,
then they will be randomly assigned a sponsor, i.e. another affiliate
in the program.

I am attempting to grab a variable from 1 of 3 different places to
display in a text box on my registration form. The variable is coming
from either (in order of importance) the querystring, a cookie or is
randomly generated from a db lookup.

In my "Form Properties/Input" area I have the following:

Field - refby_id
Variable Name - refby
Type - Param
Data Type - Text
Operation - "="
Required - "checked"
Transfer - "checked"

This works very well by grabbing the querystring and displaying it in
the text box on the form, but I can't figure out how to address add
the code for the cookie or the random entry.

I would manually code the following for the entire process:

###########################
' variables
Dim getrefRec
Dim ref
Dim randomref
Dim newref

' Random User Lookup
getrefRec = cn.execute("SELECT MAX(user_id, user_login) as MaxID from
users")
Randomize
RandomRef = Int(newrefRec("MaxID") * Rnd + 1)
newref = cn.execute("SELECT * FROM users WHERE user_id = " & randomref
& ";")

' Determine who the sponsor(new referral) will be
If NOT Request.Querystring("refby") = "" then
ref = Request.Querystring("refby")
else
If NOT Request.Cookies("refby") = "" then
ref = Request.Cookies("refby")
else
ref = newref
end if
end if
###########################

(I'm not sure if I got the "random user lookup" correct?)

Any help would be extremely appreciated!

Anthony

CodeCharge
Posted: 05/30/2001, 1:16 AM

If you already have the logic/function to what you need, then you can use it
in the "Before Show" Event on the form.
The key here is to use "fldrefby_id" variable.
And you may use GetParam("refby") to obtain the value of the parameter.
Your Event may become something like:

###########################
' variables
Dim getrefRec
Dim randomref
Dim newref

' Random User Lookup
getrefRec = cn.execute("SELECT MAX(user_id, user_login) as MaxID from
users")
Randomize
RandomRef = Int(newrefRec("MaxID") * Rnd + 1)
newref = cn.execute("SELECT * FROM users WHERE user_id = " & randomref
& ";")

' Determine who the sponsor(new referral) will be
If NOT GetParam("refby") = "" then
fldrefby_id = GetParam("refby")
else
If NOT Request.Cookies("refby") = "" then
fldrefby_id = Request.Cookies("refby")
else
fldrefby_id = newref
end if
end if
###########################



"Anthony Trotter" <support@worldnetcity.com> wrote in message
news:9f28rb$kgd$1@mail.tankhill.com...
> Anyone - PLEASE help!
>
> I have an affiliate program registration form that I am working on.
> If a person joing our affiliate program was not referred by anyone,
> then they will be randomly assigned a sponsor, i.e. another affiliate
> in the program.
>
> I am attempting to grab a variable from 1 of 3 different places to
> display in a text box on my registration form. The variable is coming
> from either (in order of importance) the querystring, a cookie or is
> randomly generated from a db lookup.
>
> In my "Form Properties/Input" area I have the following:
>
> Field - refby_id
> Variable Name - refby
> Type - Param
> Data Type - Text
> Operation - "="
> Required - "checked"
> Transfer - "checked"
>
> This works very well by grabbing the querystring and displaying it in
> the text box on the form, but I can't figure out how to address add
> the code for the cookie or the random entry.
>
> I would manually code the following for the entire process:
>
> ###########################
> ' variables
> Dim getrefRec
> Dim ref
> Dim randomref
> Dim newref
>
> ' Random User Lookup
> getrefRec = cn.execute("SELECT MAX(user_id, user_login) as MaxID from
> users")
> Randomize
> RandomRef = Int(newrefRec("MaxID") * Rnd + 1)
> newref = cn.execute("SELECT * FROM users WHERE user_id = " & randomref
> & ";")
>
> ' Determine who the sponsor(new referral) will be
> If NOT Request.Querystring("refby") = "" then
> ref = Request.Querystring("refby")
> else
> If NOT Request.Cookies("refby") = "" then
> ref = Request.Cookies("refby")
> else
> ref = newref
> end if
> end if
> ###########################
>
> (I'm not sure if I got the "random user lookup" correct?)
>
> Any help would be extremely appreciated!
>
> Anthony
>
>

Anthony Trotter
Posted: 05/30/2001, 5:47 AM

Awesome Support!

Thanks for your help. I cleaned up my code and queries and everything
works as ordered. Adding custom code in the Form "Before Show" Event
is a huge plus for those of us that like to write our own. I am now
wiz, more of a hack, but I do like to use code I have borrowed from
other sources. You should add that this functionality is available in
your sales material. I can bet that a lot of people were thinking
that CC was a closed tool for custom code like I used to.

Keep up the great work.

Anthony



"CodeCharge" <support@codecharge.com> wrote in message
news:9f2a8t$ldh$1@mail.tankhill.com...
> If you already have the logic/function to what you need, then you
can use it
> in the "Before Show" Event on the form.
> The key here is to use "fldrefby_id" variable.
> And you may use GetParam("refby") to obtain the value of the
parameter.
> Your Event may become something like:
>
> ###########################
> ' variables
> Dim getrefRec
> Dim randomref
> Dim newref
>
> ' Random User Lookup
> getrefRec = cn.execute("SELECT MAX(user_id, user_login) as MaxID
from
> users")
> Randomize
> RandomRef = Int(newrefRec("MaxID") * Rnd + 1)
> newref = cn.execute("SELECT * FROM users WHERE user_id = " &
randomref
> & ";")
>
> ' Determine who the sponsor(new referral) will be
> If NOT GetParam("refby") = "" then
> fldrefby_id = GetParam("refby")
> else
> If NOT Request.Cookies("refby") = "" then
> fldrefby_id = Request.Cookies("refby")
> else
> fldrefby_id = newref
> end if
> end if
> ###########################
>


Thierry B.
Posted: 05/31/2001, 7:33 AM

I agree. I admit I underestimated this product one week ago. In fact this is
my fault. I dowloaded the trial version and printed the pdf manual, where
there is no explanation about events, header/footer ...

At first glance I did not read carefully the online help because I believed
that it was the same thing as the pdf manual. In fact I just discovered
there was all the basics for managing events, the name of the variables,
small examples ...

T.B.

"Anthony Trotter" <support@worldnetcity.com> a écrit dans le messagenews:
9f2q45$2uj$1@mail.tankhill.com
...

> I can bet that a lot of people were thinking that CC was a closed tool for
custom code like I used to.



   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.