CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Tree Forms?

Print topic Send  topic

Author Message
lneisius
Posted: 11/09/2002, 4:52 PM

What is the best method of creating a tree form in CCS? Would it be to take the parent child approach? Does any one have a sample app to look at?
Elena
Posted: 11/12/2002, 6:27 AM

Hello,
download PHP version of tree form for CCS from:
http://www.gotocode.com/UserImages/Elena/TreePHP.zip
The tree form is like CC one
xbill
Posted: 11/12/2002, 7:30 AM

I also used a similiar approach to the
sample above- with parent/child pointers.

The "Top" record has a parent ID of NULL, with
all children having their parent ID set to a
Non-NULL value.

The layout is like:

ID TOP parent_id = NULL
ID Child1 parent_id = id of TOP
ID Child2 parent_id = id of Child1

and so on. You can then select the records
based on the parent_id. (for example select
all where parent_id is NOT NULL)

With CCS- I was even able to used the SQL editor
to link the self-referential records. In the
sql edit view- just add another copy of the table
and drag and drop it to the "parent_id" field.
CCS will automatically generate the references
to the parent record.

One thing to watch out for- some databases handle
the display of NULL values differently.

With MySQL- a NULL value can cause a record not
to display in a grid- so it appears as if the
record has disappeared. It will still be in the
database. You just need to take extra care how
you lay out your grids.

-bill

lneisius
Posted: 11/12/2002, 11:39 AM

XBill:
I'm using Access and ASP with templates. Would you have an example as I am new to this? Just email it to me if you wish, (lneisius@iwon.com) or post the code for others to see?

Elena:
Thanks for the example you pointed out. As I am new to this I dont know if I can work with the php or not but will give it a try. Is there an example of this form in asp?
xbill
Posted: 11/12/2002, 12:18 PM

There is no direct replacement for
the Tree view from CC in CCS.

The approach to emulate is CCS based-
so it is language / platform independent.

I will outline the high level steps- you
will have to do the details in your target DB
and generation language.

First - create a new table with several fields.

For example - create a new table "record" with:

record_id integer primary autoincrement not NULL
parent_id integer NULL allowed default NULL
field VARCHAR (100)

In CCS use the app builder tool in the toolbox on
the right hand side of the screen to build a new
grid, and record / edit over the "record" table.

To get the initial grid to show high level categories-
update the SQL in the Where to select all records
where the parent_id is NULL.

In the grid form- you can then use the SQL editor
to de-reference the parent_id. Open the SQL editor
from the grid selection and right click to add a table.

Add a second copy of the "record" table.
Join the record_id on the second table to the parent_id
field in the first record to use these fields.

After you have built the initial grid and edit
forms- use the grid builder tool to add a grid to select
all records where the parent_id is NOT NULL.

You could also change the layout so that when you click
the "parent_id" field- it will open up the page
on the the parent record. The exact layout will
depend on your application.

-bill
Anatoly
Posted: 11/13/2002, 7:11 PM

Please, answer me, exist Tree form extension for CCS for ASP?

lneisius
Posted: 11/14/2002, 8:23 AM

Elana:
In the tree form example that I downloaded there is a hidden field that CCs wants to remove. What should I do?
lneisius
Posted: 11/14/2002, 4:23 PM

Bill:
I am confused on the null values and have absolutely no experience with SQL so this is like rocket science to me at this time could you provide a complete step-by-step or a sample app? What I want to accomplish is similar to the classifieds example, but with more levels as I believe that this tree form is limited to three levels from what I have read on the forum? I belive that my current app would work with five levels and think that this parent child relationship would achive this.
xbill
Posted: 11/15/2002, 1:18 PM

The basic approach that I outlined is
the same way that the CC example works.

In CC (vs CCS) you just have a tree type
that hides the details.

If you have access to CC- you can look at the
generated code to see exactly what is happening.

For the design:

The "NULL" variable is used as a flag in
the parent field to track the root of the tree.

If you have problems understanding how NULLs work-
you could use an int field - for example:

int level

and set level 0 of your tree as the root and increment
the level variable each time a new child is added.

So all "roots" of the tree have level 0- all childen
of the root have level 1 - all their children have level 2,
etc.

The parent_id field always contains the higher level node-
so there is no limit to the depth of the tree.
Conceptually- it is just like some of the basic tree structure
data types.

Just to recap- here is a brief example table:

id parent name level
1 NULL root 0
2 1 level1 1
3 2 level2 2
4 3 level3 3

which is the table for:

root <--- level1 <---- level2 <---- level3

It may take a while to understand how
this works- but the approach is very flexible
when used in the right way.

-bill


   


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

MS Access to Web

Convert MS Access to Web.
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.