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

 Creating A Totally Empty Editable Grid

Print topic Send  topic

Author Message
cparke

Posts: 8
Posted: 06/30/2004, 12:40 PM

Hello to all !

I have an application where daily billing transaction line items are put into a single table. (CCS/PHP/MySQL). I have a page where you enter a batch number. This passes the new batchno parameter to another page that it calls that has an editable grid.

I want the editable grid to create a new empty row with that new batch number (the new batchno row IS being created properly in the database) and then call just that row to start data entry.

I am then going to use the Auto Row example to add each additional entry line forward for the batch line items.

What is the best way to get the SQL WHERE statement in the datasource setting to use the batchno parameter from the calling page to bring up that new row?

In the SQL Query window is there something easy I am missing, or do I need to use the ds->where technique in the BeforeBuildSelect() EVENT code page ?

How many different ways are there to do this ? What is the best way ?

In another scheme, I have found no way to bring up just an *empty editable grid*. If I set the record display to "0" I get "ERROR CCS06 Invalid Page Size". Is there anyway to bring up an entirely empty grid ? I could not do it so I went to this create one row scheme. Is there any other solution anyone has done in this situation ?

I would think it would be a fairly common situation !

Any suggestions/help would be very much appreciated !

Best to everyonel,

Thanks !
View profile  Send private message
klwillis


Posts: 428
Posted: 06/30/2004, 1:32 PM

You can modify the table query 'where clause'
and have it return only the matching record based on
the batch number value.

Within the Data Source grid property, click on the ellipses ('...')
and add the where clause.

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
cparke

Posts: 8
Posted: 07/05/2004, 5:40 PM

Thanks klwillis !

I am now clear on what to do. But I don't seem to be passing the parameter properly. I *can't* trigger the where it seems. It is bringing up my test default and *not* the passed parameter value. But I clearly see the logic of what you are suggesting.

I searched the archives here and found the info post on "Passing Parameters to the Next Form" on 5/26/04 by "unaprogrammer."

I am sending from a record form so it is sending parameters by the *post* method as the forum post says to be aware of.

In the Sending Page Fprm I put this *After Insert* Event:

$Redirect = $Redirect."create_batchno=".$Enter_Batch_No->batchno->GetValue();

In the Receiving Page Form Data Source Grid property I made the following setting:

batchno (equals=) create_batchno

This is set as a parameter coming from a URL.

Shouldn't the $Redirect from the Send page pass this to the next page where the where setting can take over ? It is acting like there is no parameter passed and goes to my test default setting.

Any ideas ? The documentation both in the product and in the forum seems to be very confused about passing parameters properly.

I am pulling up the data in the second form data as just a *table* with the parameter setting. No SQL. No Stored Procedured. This should be simple ! What am I doing wrong ???

I have read everything on the forum ten times. I'm confused ! What am I missing ?

View profile  Send private message
klwillis


Posts: 428
Posted: 07/05/2004, 9:46 PM

Please provide the syntax you are using when passing parameters
for the query.

It may be a simple syntax error.


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
klwillis


Posts: 428
Posted: 07/05/2004, 9:49 PM

Oops ... missed your syntax for the $Redirect in your prior post. :-O

I think this is what you want.

$Redirect .= "?create_batchno=".$Enter_Batch_No->batchno->GetValue();
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
peterr


Posts: 5971
Posted: 07/06/2004, 12:44 AM

cparke,
You may want to test the "Multi-Step User Registration" example in CCS Example Pack, which may help you understand how to transfer those values. That example that demonstrates how to do this properly although there could be other methods as well.
Secondly, I recommend that you always do little debugging whenever you have a problem as it is much more difficult for someone else to determine the problem without being able to test things out.
Maybe add an echo command to display the value of $Enter_Batch_No->batchno->GetValue();. This way you will be able to determine if the Redirect doesn't work or the value is empty.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
cparke

Posts: 8
Posted: 07/08/2004, 8:27 PM

Thanks Kevin and Peter !

I painstakingly went through adding a learning version following the Multi-Step User Registration Example as suggested to learn the ropes and get my feet wet on this one way of doing it.

I first set up the straight example version from the ExamplePack in my PHP/MySQL environment. I have it working perfectly.

I then wrote an experimental version for my above batch number editable grid situation. I'm very close but I am getting this error ! It is on the CCDLookup line. countdbt is an Integer so I changed it to ccsInteger as the transformation. It is the auto increment field. Could this be the problem ? It still should be there in the system as this code is *after* the Insert.

It still gets the error with the original ccsText. Do I have the transformation direction right?

I could find no documentation in the system for CCGetFromPost. Is there any documentation about it anywhere?

Any ideas on what my problem might be ?

It is hours of effort but I am learning every day !

Code Charge Studio is a great product concept. If I could just become a master on all the ways to pass parameters and how to use all the event situations, I would feel so much better. Let me know if anyone has written a tutorial on this step by step with lots of examples. I'm thinking about doing it myself if no one else has done it yet. That is all this product is lacking. This product is well worth learning. It is the future for cross platform web development as far as I am concerned. Very well worth the effort to learn !

Thanks !

Fatal error: Call to a member function on a non-object in c:\inetpub\wwwroot\CBL1\MMultiStepBNO2_events.php on line 30

This is the offending code:

//batch_AfterInsert @2-D8319695
function batch_AfterInsert()
{
$batch_AfterInsert = true;
//End batch_AfterInsert

//Custom Code @8-05DC67BA
// -------------------------
//-----------------------------------------------------
// Write your own code here.
//-----------------------------------------------------
//Retrieve the last inserted key if a new user is registered
//This method of retrieving the last inserted key is safe because the value of the user_login field has to be unique.
//-----------------------------------------------------
global $batch;
global $Connection_CBL1;
global $Redirect;
global $LastBNO;

if(!CCGetFromGet("batchno",0)) {
$LastBNO = CCDLookup("batchno","batch","countdbt=".$Connection_CBL1->ToSQL(CCGetFromPost("countdbt",""),ccsInteger),$Connection_CBL1);
if (strpos($Redirect,"?") == false ) {
$Redirect = $Redirect."?batchno=".$LastBNO;
} else if (substr($Redirect,-1) == "?" ) {
$Redirect = $Redirect."batchno=".$LastBNO;
} else {
$Redirect = $Redirect."&batchno=".$LastBNO;
}
}
//-----------------------------------------------------
//End Custom Code
//-----------------------------------------------------

// -------------------------
//End Custom Code

//Close batch_AfterInsert @2-2105C503
return $batch_AfterInsert;
}
//End Close batch_AfterInsert
?>




View profile  Send private message
peterr


Posts: 5971
Posted: 07/08/2004, 9:06 PM

The only issue I see for now is that CCGetFromPost("countdbt","") should be CCGetFromPost("countdbt",0) when dealing with integers. CCGetFromPost is a very simple function (2 lines of code) that obtains the value of the URL parameter. The first function parameter is the name of the URL parameter, while the 2nd value is the default value. You can search Common.php for 'CCGetFromPost' to see how it works there.
In your case the default value should be numeric.
Everything else looks OK so far.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
DonB
Posted: 07/08/2004, 9:11 PM

I'd use CCGetParam() all the time. It will ferret out the parameter
regardless of whether it's Get or Post.

Looks like the connection object does not exist. Shouldn't it be
$DBConnection_CBL1? Try creating your own with

$myConnection = new clsDBConnection_CBL1()

and try that inside the event.

DonB



--
DonB

logging at http://www.gotodon.com/ccbth, and blogging at
http://ccbth.gotodon.net
klwillis


Posts: 428
Posted: 07/09/2004, 2:11 PM

You may have already gotten a response, but here is one solution
to you CCDLookup problem:

CCDLookup("batchno","batch","countdbt=".CCGetParam("countdbt",0),$DB<your-connection-name>);


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
cparke

Posts: 8
Posted: 07/09/2004, 4:19 PM

Thank you DonB and Kevin Willis !

Yes. That was the immediate problem !

$DB<your-connection-name>

Where does this convention come form ? Is this a CCS thing or a PHP thing or a MySQL thing ? I'm an old timer in programming but I am new to the scripting languages for web programming.

I had gotten confused when I was working with the ExamplePack. I had one version of the Multi Step Registration in PHP working flawlessly *without* this $DB prefix syntax. How was that possible ? Once I added the $DB syntax here, I was on my way to the next page. Again, my thanks !

Today I realized I should be looking for the *countdbt* value through the passed batchno parameter value and *NOT* the other way around. I changed the syntax to this and I am now getting the action I want in the next page ! The new record appears as the first record in an editable grid for the new batch transaction entry. There is more to do, but I am now in the right church and very close to the right pew.

Blessings upon you, brothers !

Here was the proper solution. "countdbt" is an *auto increment* field, so this shows that it can be done for this situation. Enter a record, then navigate to it through the user assigned batch number after you are sure that the record now exists with the proper auto increment field in the database. I am sure allot of other folks out there could have a similar situation some time. This is how I did it via the *After Insert* event:

global $DBConnection_CBL1;
global $Redirect;

if(!CCGetFromGet("countdbt",0)) {
$LastBNO = CCDLookup("countdbt","batch","batchno=".$DBConnection_CBL1->ToSQL(CCGetFromPost("batchno",""),ccsText),$DBConnection_CBL1);

if (strpos($Redirect,"?") == false ) {
$Redirect = $Redirect."?countdbt=".$LastBNO;
} else if (substr($Redirect,-1) == "?" ) {
$Redirect = $Redirect."countdbt=".$LastBNO;
} else {
$Redirect = $Redirect."&countdbt=".$LastBNO;
}
}






View profile  Send private message
klwillis


Posts: 428
Posted: 07/09/2004, 9:38 PM

I was just being generic with the actual connection string:
$DB<your-connection-name>; where <your-connection-name>
is the connection variable you need.

In your case, the global connection variable would be:
$DBConnection_CBL1;
where <your-connection-name> == Connection_CBL1

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
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.