cancel
Showing results for 
Search instead for 
Did you mean: 

WETreeMenu question for the HTML experts

Former Member
0 Kudos

<p>Hi, to start off I am not an HTML expert, hence the question.</p><p>I am trying to reproduce the tree structure shown in the web seminar. I&#39;ve tried using the WETreeMenu formula and all I seem to get are multiple roots and subsections, displayed individually and not selectable.</p><p>Does anyone have an example of a fully functional tree structure they could share? I&#39;m looking for syntax for a tree structure like the one from the web seminar, colours, multiple selectable roots to multiple subsections. basically the whole 9 yards.</p><p>&#160;</p><p>Thanks in advance.</p><p>&#160;</p>

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Kudos

hello,

watch in the next week or so for a download called Crystal Reports Web Pack that will have a portal example (using the tree menu & the tab menu), an interactive quadrant report, and a Yahoo maps integration example.

the syntax for an example tree menu that would work with the xtreme sample reports & database would beÂ

// the following is the default font that will be used for the treeitem links
stringvar fontlink:= WEFont ("Verdana", 8, "Navy", "Left", false, false, "", "");

// create the links to the treeitems that you wish to use in the portal below
stringvar treeitem1:= WETargetPath ("rpt","Name", "Employee Profile (Alphabetical with Employee Picture)", "");
treeitem1:= WEOpenInTargetLink("employee profile", "CCViewer", treeitem1, fontlink);
stringvar treeitem2:= WETargetPath ("rpt","Name", "Employee Sales (Quarterly Report)", "");
treeitem2:= WEOpenInTargetLink("employee sales", "CCViewer", treeitem2, fontlink);
stringvar treeitem3:= WETargetPath ("rpt","Name", "Product Catalog", "");
treeitem3:= WEOpenInTargetLink("product catalog", "CCViewer", treeitem3, fontlink);
stringvar treeitem4:= WETargetPath ("rpt","Name", "World Sales Report", "");
treeitem4:= WEOpenInTargetLink("product sales", "CCViewer", treeitem4, fontlink);
stringvar treeitem5:= WETargetPath ("rpt","Name", "Order Packing List", "");
treeitem5:= WEOpenInTargetLink("order list", "CCViewer", treeitem5, fontlink);
stringvar treeitem6:= WETargetPath ("rpt","Name", "Mail Labels", "");
treeitem6:= WEOpenInTargetLink("order labels", "CCViewer", treeitem6, fontlink);

// generate the tree menu below
stringvar treelinks:=
"Employee Reports" + "|" +
treeitem1 + "|" +
treeitem2 + "|" +
"Product Reports" +"|" +
treeitem3 + "|" +
treeitem4 + "|" +
"Order Reports" + "|" +
treeitem5 + "|" +
"Admin" + "|" +
treeitem6;
stringvar hierarchy:= '0|1|1|0|1|1|0|1|1|2';
WETreeMenu ("treelist", treelinks, hierarchy)

paste the above into a single new formula and you'll have a functional tree menu.

jamie

Former Member
0 Kudos

<p>Thanks for the examples, they have proven very useful.</p><p>I do have 1 more question.</p><p>Can theu00C2 tree sublevels be dynamically populated for N levels? i.e. </p><p>Projects - <ProjectName></p><p>Are there any examples of this?</p><p>Thanks foru00C2 all your help.u00C2 </p>

JWiseman
Active Contributor
0 Kudos

have a look at the DCP example that is in the zip...all controls can be dynamically populated using the same method that is used in this report. a tree menu or tab menu can be dynamically populated the same way...you will have to write a formula that maps each folder / target report to a heirarchy value.

when you have an asp / jsp page that is used to do a database hit and then create a javascript array, this is similar to using a subreport to roll the values up with webelements...i.e. a data hit is done and the values are rolled up to be used with the controls that are in the main report.

 open up the subreports in this example and then look at the formula syntax...it is commented to assist you in rolling up values.

Former Member
0 Kudos

I spent sometime looking at and testing the dynamic loading of a tree structure. I have a base template for my tree, the problem is this:

I use a stored procedure to get all Project names from a database I want all of them to be part of the tree structure (3rd level). the sublevels for the projectname are always the same (level 4).

IÂ am trying to create the following structure and it doesn't seem to work using the method in the DCP example. I know I must be doing something wrong.

labs (level1)

---- projects(level2)

----


ProjectName (level3)Â (this is the level i want reproduced with all of the projects from the grouping, just like grouptree in crystal)

----


sublevels (level4)Â 1-5

----


Projectname2(level3)

----

-


sublevels(level4) 1-5

and so on for all projectname listings

I would appreciate any help you can give.

Thanks

Former Member
0 Kudos

<p>Hi, I have been looking and testing the dynamic loading of a treemenu based on retrieved group information from my database and have been unsuccessful. again I want to have canned elements steming from an unknown root for n instances. </p><p>the DCP example doesn&#39;t seem to help.</p><p>please help.</p>

JWiseman
Active Contributor
0 Kudos

i'm not sure if your stored proc already (a) segregates the data into separate fields (so that you can create several levels of groups) or (b) assigns the data into a numerical heirarchy, but this is imperative if you want to have a tree menu dynamically populated.

(a) if you've created a stored procedure that segregates the data into separate fields then using the DCP example you would change your 1st Level formula to something like

whileprintingrecords;

// change display1Â to what you wish to display in your control

stringvar display1:= {your 1st level grouping field};
stringvar value1:= "0";

// you do not need to change the syntax below
numbervar l2c:= 0;
shared stringvar P1V1; shared stringvar P1D1;
P1V1 := P1V1 + value1 + "|"; P1D1 := P1D1 + display1 + "|";

then the 2nd Level formula to something like

whileprintingrecords;

// change display2Â to what you wish to display in your control

stringvar display2:= replace({Categories.CategoryName},'"','');
stringvar value2:= "1";

// you do not need to change the syntax below
numbervar l3c:= 0;
numbervar l2c:= l2c + 1;
stringvar display1; stringvar value1; shared stringvar P1D2; shared stringvar P1V2;
if l2c = 1 then (P1V2:= P1V2 + "||" + value1 + "|"; P1D2:= P1D2 + "||" + display1 + "|";);
P1V2:= P1V2 + value2 + "|"; P1D2:= P1D2 + display2 + "|";

the Final Values formula then looks something like

whileprintingrecords;

shared stringvar P1D1:= P1D1[1 to length(P1D1)-1];
shared stringvar P1D2:= P1D2[1 to length(P1D2)-1]; P1D2:= replace(P1D2, "|||", "||");

shared stringvar P1V1:= P1V1[1 to length(P1V1)-1];
shared stringvar P1V2:= P1V2[1 to length(P1V2)-1]; P1V2:= replace(P1V2, "|||", "||");

(b) if you've got a stored proc that simply assigns each tree display a numerical heirarchy then you roll up two stringvars at the same time...the tree displays and the heirarchy values...you want the values to roll up so they are passed to the main report like '0|1|1|0|1|1|0|1|1|2'
Â

Former Member
0 Kudos

<p>Hi, the stored procedure is simple in structure only retreiving specific fields ordered by projectname. is there a specific method I should use to ensure my projectnames are grouped? I ran the code you sent (as best i could) and only the first project name is being retrieved. I use the crystal grouping function and it sees all of them. I&#39;m sure that I am missing something here, and I hate to bug, but this a crucial.</p><p>thanks.</p>

JWiseman
Active Contributor
0 Kudos

hello, as only you know how the data is intended to be grouped, and since it doesn't sound like your heirarchy is in a database table, you'll have to:

a) write an If Then Else formula that outputs the levels of the content based on any potential piece of data that comes in (time consuming for both development & maintenance) or

b) put the folder heirarchy and report information in a separate table outside of the repository and use this in the heirarchy level variable (less time consuming for development but you'll have to update this)

c) scrap using a stored procedure and report off of the repository using a POJO driver bringing in your folders, subfolders, content (sounds like your best bet)Â *** please search on diamond or kbase for examples on doing this as this would not be part of this forum

Former Member
0 Kudos

I am a little confused. if I am only wanting to dynamically create a single level of the treemenu n times, why is it important to store the heirarchy? by heirarchy do you mean the actual display names for the tree levels?

only 1 value from the result set is used. What would I have to do to create the heirarchy? what would it contain?

and finally, I've tried capturing the values coming in and haven't found a way to do this. Is there a function or method I could use?

thanks for your patience.

JWiseman
Active Contributor
0 Kudos

<p>hello, can you please let us know what overall objective that you are trying to accomplish...i.e. what does the end report look like and what is the end user doing with it.</p><p>the reason why i ask is that it doesn&#39;t sound like you need a tree menu if you only have 1 value repeated and no heirarchy.</p><p>there are lots of other linking methods such as a link box that you can use. </p>

Former Member
0 Kudos

sorry for the confusion.

I have an image of the desired results but seem to be unable to attach it.

The idea is to replicate a current program that displays in a tree structure all project names and seperate sublevels, the sublevels are canned and will appear the same for all projectnames. There could be any number of unique projectname tree levels and its sublevels are links to reports that are passed the associated projectname, that is why all the questions and the desire for a dynamic tree population. I hope this makes things clearer.

I am not opposed to other suggestions or methods, I would like to mimic the original application as closely as possible though if I can, but if there is another way to do this quickly and efficiently (and user friendly) I would be more then happy to use that method.

also, if anyone else has successfully created a dynamic tree menu based on group or database values, please post your method.Â

JWiseman
Active Contributor
0 Kudos

<p>hello, in this case this brings us back to several posts ago with the 3 methods of creating the tree menu. any of these methods will work to create a dynamic tree or a tab menu. it&#39;s the same method used to create any other live controls except you are adding in one additional component of assigning a heirarchy level to each value.</p><p>you will have to create as mentioned before a formula that develops the heirarchy variable to be used in the tree menu. if you don&#39;t properly create that "0|1|1|2..." variable then your tree menu will not have any folders or subfolders. </p><p>whether you do so via entering the values into a database or creating a huge if then else statement is up to you but it still has to be done. it would have been done to create the program&#39;s tree menu so you may want to find out the logic that was used there.</p><p>have a look at the sample report and look at the 2 variables that are used to generate the tree menu to get an idea of what the control is expecting.</p><p>even if you repeat a bunch of nodes, you&#39;ll have to right into your formula something that adds these nodes onto the string running total at a certain group level. you mentioned that a bunch of values repeat n times at a certain level so that should be a matter of adding the same text to the string variables at each level.</p>

Answers (0)