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

 Grid with sub forms

Print topic Send  topic

Author Message
Lucky
Posted: 10/19/2003, 4:49 AM

Did somebody succeed to make two grids in one form which are connected in one-to-many relationship?
This is like in Access (Parent-Child).
For example connecting a head of family and his childs but in CCS I can't do this thing.
I'm using CCS 2.2 latest version, PHP and MySql.

Thanks in advance
Lucky
ryan
Posted: 10/20/2003, 11:26 PM

Lucky you need custom programming for that, a typical CCS grid would be
======================================================================
<!--Begin Grid FormName-->
<table>
<tr>
<td>
ID
</td>
<td>
Description
</td>
</tr>

<!--Begin Row-->
<tr>
<td>
{ID}
</td>
<td>
Description
</td>
</tr>
{Child}
<!--End Row-->

<!--Begin NoRecords-->
<tr>
<td colspan="2">
No records !!!
</td>
</tr>
<!--End Norecords-->

<tr>
<!-- Begin Navigation-->
<td colspan="2">
NavigatorPagehere_
</td>
<!-- End Navigation-->
</tr>

</table>
<!--End Grid FormName-->
======================================================================
This means you cannot insert anything (include file, record another grid form with parameter, etc. because it's inside the <!-- Begin Grid, <!-- End Grid block, can you see the {Child} I placed above? That means you can create any programming in the before show event of the ID (label).

Since I only know PHP, I presume you can get the trick done with PHP as well what I would do is do this for ASP :)

Function BeforeShow_formname_ID()
'write ur code here
dim getthechild, RS, SQL
SQL = "SELECT child from table " & _
"WHERE (MasterID="&formname.ID.value&") "
Set RS = DB<ConnectionName>.Execute(SQL)
IF NOT RS.EOF THEN
DO UNTIL RS.EOF
getthechild = getthechild & RS(0) & ", "
RS.MoveNext
LOOP
END IF
RS.Close : Set RS = Nothing
HTMLTemplate.SetVar "@Child", getthechild
End function

Now what I did is loop the foreign data (comma separated) and use the Child template variable to hold it. This occurs for every row, the reason it's inside the <!--begin, <!--end row blocks.

You can use functions, or tables depending on what you like a working example of this is the Header-Based Roles simulation I made <http://www13.brinkster.com/charmangel/TestProject/www/HeaderBasedRoles.asp>.

Wherein you assign headers to various users, display headers for that user. (master-child, one to many)

You will be able to do it as well. They say PHP is exceptional :)
ryan
Posted: 10/20/2003, 11:46 PM

oops i do not know PHP that's what I meant only ASP :)
Marcus
Posted: 10/21/2003, 8:30 AM

Ryan, can you share the Test Project (CCS/ASP) that the link goes to?

Rex_marcus@yahoo.com
Lucky
Posted: 10/22/2003, 7:19 AM

Thanks Ryan, but I’m working only in PHP and I think I wasn't clear in explaining this thing to you.
I need to make two grids in one page, and than first grid to display parent record and second to display childrens record using depending on ID.
For example when I click on a fro example Head of family, than I need to have childrens displayed on another table.
I've checked your proposal but without code I can't do anything to study this case. It will be nice if you share CCS project with us.
Thanks
ryan
Posted: 10/22/2003, 7:50 AM

ok if I am not lazy I'll come up with another example I thought you just want examples of master child...

like

master1
.....child1.....child2.....childn
master2
.....child1.....child2.....child4
.....child5.....child6.....child7
mastern

Which is the exact thing I did it's a grid form getting customized tabular data of children but if that's your request I'll think I'll use another obvious example. Bye for now :)

   


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.