CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Lookup SQL

Print topic Send  topic

Author Message
kipdole
Posted: 01/22/2003, 9:20 AM

NEWBEE I can't figure out why this LOOKUP SQL and generated code below is failing.

//CODE SNIPPET IN LOOKUP SQL
SELECT email_address_id, email FROM dbo_email_address where company_id = "& fldclient_id &"

//GENERATED CODE
SetVar "call_date", ToHTML(fldcall_date)
SetVar "client_id", ToHTML(fldclient_id)
SetVar "edit_call_logLBemail_address_id", ""
SetVar "Selected", ""
SetVar "ID", ""
SetVar "Value", semail_address_idDisplayValue
Parse "edit_call_logLBemail_address_id", True
openrs rsemail_address_id, "SELECT email_address_id, email FROM dbo_email_address where company_id = "& fldclient_id &""

Thanks in advance!
Kip
kipdole
Posted: 01/22/2003, 3:52 PM

*// Lookup SQL code that finally at least appears to work.
*// My brain is too small to currently understand how the dependent list boxes work but this code may do. I hope that someone else uses this code because it took me many hours. Probably 5. I don't understand this. What does this function do anyways? ToSQL()

// Yes this works (:
SELECT email_address_id, email from dbo_email_address WHERE company_id = "& ToSQL(fldclient_id, "Number") &"

// I found tips like this that failed ):
SELECT email_address_id, email from dbo_email_address WHERE company_id = "& fldclient_id &"


kipdole
Posted: 01/24/2003, 1:49 PM

If anyone of a better way of doing this please let me know. Thanks.

How many times do you think you have the answer only to figure out that you still have a problem. The previous code which I thought worked didn't when I changed the display of the client_id to the client name instead of the clients id but I think I figured it out and just wanted to post it.

Here is my fix.

1. The form I am using is 3 part.
a. Search
b. Grid
c. Record

-From the search screen I pass a variable called s_client_id to the grid and
make check the transfer parameter. This keeps the variable alive to pass to pass to the the Record.
-On the grid I pass in the url the client_id and call the variable s_client_id1

//NEW CODE SNIPPET IN LOOKUP SQL
SELECT email_address_id, email from dbo_email_address WHERE company_id="& ToSQL(ToHTML(GetParam("s_client_id1")), "Number") &" UNION SELECT email_address_id, email from dbo_email_address WHERE company_id="& ToSQL(ToHTML(GetParam("s_client_id")), "Number") &"

*Note: Notice the union clause. This is because sometimes s_client_id does have a value if you click on a url. Also we need to use s_client_id1 because it does not have a value like when you click the Search button.

**Note: You must select a customer and press search to insert a new customer.

If anybody wants the code let me know and I will post it.







   


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.