CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Setting a variable value depending on listbox.

Print topic Send  topic

Author Message
tim2boles

Posts: 16
Posted: 08/05/2007, 9:00 PM

Hello all,

I am a newbie to PHP and codecharger. I am trying to get something to work and can not find the right combination of things to make to go.

I have two tables that are connected with a foreign key.
clients. client_id pk
contacts.client_id fk

Lets say that the clients.client_id is a text field (just because I need it to be that way for this example). I have created a list box that has the bounded column as clients.client_id and the textcolumn as clients.client_name.

Now I want to have a variable IntClient_id that is an integer. Can someone help me figure out how to cast the bounded column clients.client_id to an integer and set the variable IntClient_id the results.

IntClient_id=tointeger(bounded column from list)

Regards
Tim
View profile  Send private message
wkempees
Posted: 08/06/2007, 3:25 AM

intval()

! does not work on arrays and objects.

Walter

"tim2boles" <tim2boles@forum.codecharge> schreef in bericht
news:546b69cd92f3de@news.codecharge.com...
> Hello all,
>
> I am a newbie to PHP and codecharger. I am trying to get something to
> work and
> can not find the right combination of things to make to go.
>
> I have two tables that are connected with a foreign key.
> clients. client_id pk
> contacts.client_id fk
>
> Lets say that the clients.client_id is a text field (just because I need
> it to
> be that way for this example). I have created a list box that has the
> bounded
> column as clients.client_id and the textcolumn as clients.client_name.
>
> Now I want to have a variable IntClient_id that is an integer. Can
> someone
> help me figure out how to cast the bounded column clients.client_id to an
> integer and set the variable IntClient_id the results.
>
> IntClient_id=tointeger(bounded column from list)
>
> Regards
> Tim
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Hidran
Posted: 08/06/2007, 6:07 AM

Codecharge does it for you. Set Data type to integer in your listbox
properties.
Hidran
"tim2boles" <tim2boles@forum.codecharge> ha scritto nel messaggio
news:546b69cd92f3de@news.codecharge.com...
> Hello all,
>
> I am a newbie to PHP and codecharger. I am trying to get something to
> work and
> can not find the right combination of things to make to go.
>
> I have two tables that are connected with a foreign key.
> clients. client_id pk
> contacts.client_id fk
>
> Lets say that the clients.client_id is a text field (just because I need
> it to
> be that way for this example). I have created a list box that has the
> bounded
> column as clients.client_id and the textcolumn as clients.client_name.
>
> Now I want to have a variable IntClient_id that is an integer. Can
> someone
> help me figure out how to cast the bounded column clients.client_id to an
> integer and set the variable IntClient_id the results.
>
> IntClient_id=tointeger(bounded column from list)
>
> Regards
> Tim
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

tim2boles

Posts: 16
Posted: 08/06/2007, 12:28 PM

But that is the rub of it as you can see from my posting in:
http://forums.yessoftware.com/posts.php?post_id=89257

That is not working....

Thanks for your insightes but can someone be explict and show me the coding of setting a variable Int_client_id to be the integer value of what has been choosen in the list box as the bound variable. (Can it be done?)

Similarly lets say I want to place the results of the bound variable in a control to be displayed on the screen. (Can this be done?)

I am having trouble understanding how to do this with PHP or CCS.

Regards
Tim
View profile  Send private message
datadoit.com
Posted: 08/06/2007, 2:28 PM

tim2boles wrote:
> Lets say that the clients.client_id is a text field (just because I need it to
> be that way for this example).
> ---------------------------------------

Wouldn't this create your problem? If you want the bound column of your
listbox to save as an integer, then your field needs to be defined as an
integer also.

Otherwise, your problem isn't in how CCS is posting the data, but rather
how you're attempting to shove a square peg into a round hole (or an
integer into a text field). Look at how MSSQL handles situations like
this - which may answer why your text/integer mysteriously becomes a
float value. I'm a little surprised that MSSQL would even allow you to
create a foreign key on a text and an integer field. But, I've never
dealt with FK's.

If your structure MUST be this way, then look at doing a
BeforeExecuteInsert or BeforeExecuteUpdate event to change the variable
type of the field to the format you need it in using PHP functions like
gettype(), intval(), strval(), and settype().
tim2boles

Posts: 16
Posted: 08/06/2007, 3:06 PM

Thanks Datadoit for your insight.

I am having problems with CCS and I am trying to find a work around to the problem. That is way I said "for the example the field is text". In my project it is really an integer that is being read as something totally different. I am trying to "force" a variable to be equal to the bound column in the list box, but I want it to cast as an integer. You can see the link to the actual problem in one of my eariler postings.

So basically I am back to the same thing.

What is the PHP/CCS syntax to use in my custom code that I need to create to set the bound column in a list box to a variable and make it be read as an integer?

InVariableID = CASTSYNTAX(boundColumnInListBox) ?????

I think I see someone answered me above with a syntax but said it could not be used on arrays which a list box consists of.

Regards
Tim
View profile  Send private message
tim2boles

Posts: 16
Posted: 08/06/2007, 3:21 PM

Thanks wkempees

So simple but yet I still had no idea. This worked just fine for what I needed. Thanks a lot.

Regards
Tim

Quote wkempees:
intval()

! does not work on arrays and objects.

Walter

"tim2boles" <tim2boles@forum.codecharge> schreef in bericht
news:546b69cd92f3de@news.codecharge.com...
> Hello all,
>
> I am a newbie to PHP and codecharger. I am trying to get something to
> work and
> can not find the right combination of things to make to go.
>
> I have two tables that are connected with a foreign key.
> clients. client_id pk
> contacts.client_id fk
>
> Lets say that the clients.client_id is a text field (just because I need
> it to
> be that way for this example). I have created a list box that has the
> bounded
> column as clients.client_id and the textcolumn as clients.client_name.
>
> Now I want to have a variable IntClient_id that is an integer. Can
> someone
> help me figure out how to cast the bounded column clients.client_id to an
> integer and set the variable IntClient_id the results.
>
> IntClient_id=tointeger(bounded column from list)
>
> Regards
> Tim
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


View profile  Send private message

Add new topic Subscribe to topic   


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

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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