Printing Tree

Hi,
have any body created a report which would print a tree in Oracle Reports 10g? If so, please let me know how.
Thanks in advance,
Saumen.

If you would like to print the Table of Contents tree, you can choose File | Print Tree, but you must not have selected a topic node in the tree.
When you want to print the tree, select only a book node. For any other TOC selection the Print Tree item should be grayed out and this bug has been targeted to be fixed in JDev 9.0.3
BTW: you can also print individual help topics when you open the topic in the "Help Topic Window". The menu command File | Print Topic gives you this choice.

Similar Messages

  • How to print tree layout in Sun?

    We are in the process of switching from a Sun box to a Windows 2003 box. I need to know how to print the tree layout in Sun so I can properly map paths and directories.
    Thanks

    Hello.
    If you are looking for a command similar to "tree" in DOS/Windows: I do not know if there is an equivalent but I wrote a program to do this myself. The output is not very good yet.
    #include <stdio.h>
    #include <string.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <dirent.h>
    void printtree(char *dname,int lvl,dev_t dev)
        struct stat st;
        struct dirent *dnt;
        static char buf[500];
        DIR *d;
        int i,l,m;
        l=strlen(dname);
        if(!dev)
            stat(dname,&st);
            dev=st.st_dev;
        d=opendir(dname);
        if(!d) return;
        dname[ l ]='/';
        while((dnt=readdir(d))!=NULL)
            if(strcmp(dnt->d_name,".") && strcmp(dnt->d_name,".."))
            m=0;
            strcpy(dname+l+1,dnt->d_name);
            lstat(dname,&st);
            if(S_ISLNK(st.st_mode))
                stat(dname,&st);
                if(S_ISDIR(st.st_mode)) m=1;
            else if(S_ISDIR(st.st_mode)) m=2;
            if(m)
                for(i=0;i<lvl;i++) printf("|   ");
                printf("+ %s",dnt->d_name);
                if(m==1)
                    i=readlink(dname,buf,sizeof(buf)-1);
                    if(i<0) printf(" <unknown symlink>");
                    else
                        buf[ i ]=0;
                        printf(" <symlink to %s>\n",buf);
                else if(st.st_dev!=dev)
                    printf(" <mount point>\n");
                else
                    printf("\n");
                    printtree(dname,lvl+1,dev);
        closedir(d);
        dname[ l ]=0;
    main(int argc,char **argv)
        static char a[500];
        strcpy(a,(argc>1)?(argv[1]):".");
        printtree(a,0,0);
        return 0;
    }I hope this helps.
    Martin

  • Error printing : Tree connect failed (NT_STATUS_DUPLICATE_NAME)

    We have a Kyocera printer that uses a queue on Windows server of Equitrac.
    To configure the printer perform the following configuration in system preferences:
    Printer and fax
    Add a printer "+"
    Customize Toolbar
    Add the Advanced Menu
    Select Type: Windows
    URL: smb: / / user: password @SECTORIALES/128.90.249/kyoceraMAC
    Select your printer model
    Macs are not in domain. Each time we need to change the password we have to delete the printer and recreate it.
    But we fail message:
    Tree connect failed (NT_STATUS_DUPLICATE_NAME)
    I need help
    Please.
    Jorge

    Your syntax looks incorrect. If you are using the IP address of the Windows print server (which also appears to be incorrect but I suspect that is just a typo) then you also don't need the domain name - which I assume is SECTORIALES. If this name is the computer name then you don't need the IP address and the computer name - just one of them is sufficient.
    So the URL should be
    smb://user:password@IP_address/share_name

  • Print XML from tree

    Hey, I'm trying to print tree nodes into XML. The code below prints out the tags, but I have no way of getting the end tags identified and printed. Any help will be much appreciated.
    public static void printDescendents(TreeNode node){
    System.out.prinln(node);  
    Enumeration children = root.children();
       if (children != null){
          while children.hasMoreElements()){
             printDescendents((TreeNode) children.nextElement());
    }

    I have no idea whether printing the node prints a start tag or an end tag or what. But here's what I would do:public static void printDescendants(TreeNode node){
      // print start tag
      Enumeration children = node.children();
      if (children != null){
        while children.hasMoreElements()){
          printDescendants((TreeNode) children.nextElement());
      // print end tag
    }I also corrected the spelling of your method name and changed the Enumeration so it gets the children of the node the method is dealing with.
    Looking at the result, I wouldn't call the method printDescendants if it's also going to print data from the node itself. Maybe printNode would be a better name.

  • Problem with trees(Duplication of the parent node in creation of  children)

    Hi guys i am experiencing a slight problem with the creation of trees.Here is a clear explanation of my program.I created a program that generates edges from a set of datapoints then use each and every edge that is generated to create multiple trees with the edge as the rootnode for each and every tree.Everything up to so far everything went well but the problem comes when i want the program to pick every single tree and traverse through the set of generated edges to create the children of a tree.What it does at the moment for each tree is returning the a duplication of the parent node as the child nodes and that is a problem.Can anyone related with this problem help.Your help will be appreciated.
    The code
    TreeNode class
    package SPO;
    import java.util.*;
    public class TreeNode
            Edge edge;
            TreeNode node;
         Vector childrens = new Vector();
            public TreeNode(Edge edge)
                    this.edge = edge;
            public synchronized  void insert(Edge edge)
                    if(edge.fromNode == this.edge.toNode)
                            if(node == null )
                                    node = new TreeNode(edge);
                                    childrens.add(node);
                            else
                        node.insert(edge);
                                    childrens.add(node);
    Tree class
    package SPO;
    import java.util.*;
    public class Tree
            TreeNode rootNode;
         public Tree()
                    rootNode = null;
            public Tree[]  createTrees(Vector initTrees,Vector edges)
                   Tree [] trees =  new Tree[initTrees.size()];
                   for(int c = 0;c < trees.length;c++)
                      trees[c] = (Tree)initTrees.elementAt(c);     
                   for(int i = 0;i < trees.length;i++)
                            for(int x = 0;x < edges.size();x++)
                                    Vector temp = (Vector)edges.elementAt(x);
                                    for(int y = 0;y < temp.size();y++)
                                           trees.insertNode((Edge)temp.elementAt(y));
    return trees;
    public void printTree(Tree tree)
    System.out.print("("+tree.rootNode.edge.fromNode.getObjName()+","+tree.rootNode.edge.toNode.getObjName()+")");
    Vector siblings = tree.rootNode.childrens;
    for(int i = 0; i < siblings.size();i++)
    TreeNode node = (TreeNode)siblings.elementAt(i);
    System.out.print("("+node.edge.fromNode.getObjName()+","+node.edge.toNode.getObjName()+")");
    System.out.println();
    public Vector initializeTrees(Vector edges)
    Vector trees = new Vector();
    for(int i = 0;i < edges.size();i++)
    Vector temp = (Vector)edges.elementAt(i);
    for(int j = 0;j < temp.size();j++)
    Tree tree = new Tree();
    tree.insertNode((Edge)temp.elementAt(j));
    trees.add(tree);
    return trees;
    public synchronized void insertNode(Edge edge)
    if(rootNode == null)
    rootNode = new TreeNode(edge);
    else
    rootNode.insert(edge);
    EdgeGenerator class
    package SPO;
    import java.util.*;
    import k_means.*;
    public class EdgeGenerator
         public EdgeGenerator()
    public Vector createEdges(Vector dataPoints)
    //OrderPair orderPair = new OrderPair();
    Vector edges = new Vector();
    for(int i = 0;i < dataPoints.size()-1 ;i++)
    Vector temp = new Vector();
    for(int j = i+1;j < dataPoints.size();j++)
    //Create an order of edges
    Edge edge = new Edge((DataPoint)dataPoints.elementAt(i),(DataPoint)dataPoints.elementAt(j));
    temp.add(edge);
    edges.add(temp);
    return edges;
    Edge class
    package SPO;
    import k_means.*;
    public class Edge
    public DataPoint toNode;
    public DataPoint fromNode;
    public Edge(DataPoint x,DataPoint y)
    if (x.getX() > y.getX())
    this.fromNode = x;
    this.toNode = y;
    else
    this.fromNode=y;
    this.toNode = x;
    Entry Point
    package SPO;
    import java.util.*;
    import k_means.*;
    public class Tester {
         public static void main(String[] args)
              Vector dataPoints = new Vector();
              dataPoints.add(new DataPoint(140, "Orange"));
              dataPoints.add(new DataPoint(114.2, "Lemmon"));
              dataPoints.add(new DataPoint(111.5, "Coke"));
              dataPoints.add(new DataPoint(104.6, "Pine apple"));
              dataPoints.add(new DataPoint(94.1, "W grape"));
              dataPoints.add(new DataPoint(85.2, "Appletizer"));
              dataPoints.add(new DataPoint(84.8, "R Grape"));
              dataPoints.add(new DataPoint(74.2, "Sprite"));
              dataPoints.add(new DataPoint(69.2, "Granadilla"));
              dataPoints.add(new DataPoint(59, "Strawbery"));
              dataPoints.add(new DataPoint(45.5, "Stone"));
              dataPoints.add(new DataPoint(36.3, "Yam"));
              dataPoints.add(new DataPoint(27, "Cocoa"));
              dataPoints.add(new DataPoint(13.8, "Pawpaw"));
    EdgeGenerator eg = new EdgeGenerator();
    Vector edges = eg.createEdges(dataPoints);
    Tree treeMaker = new Tree();
    Vector partialTrees = treeMaker.initializeTrees(edges);
    Tree [] trees = treeMaker.createTrees(partialTrees,edges);
    for(int i = 0;i < trees.length;i++)
    treeMaker.printTree(trees[i]);
    The program output
    Each and every "@" symbol represents the start of a tree
    @(Orange,Lemmon)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)
    @(Orange,Coke)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)
    @(Orange,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Orange,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Orange,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Orange,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Orange,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Orange,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Orange,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Orange,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Orange,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Orange,Cocoa)(Cocoa,Pawpaw)
    @(Orange,Pawpaw)
    @(Lemmon,Coke)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)
    @(Lemmon,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Lemmon,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Lemmon,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Lemmon,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Lemmon,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Lemmon,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Lemmon,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Lemmon,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Lemmon,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Lemmon,Cocoa)(Cocoa,Pawpaw)
    @(Lemmon,Pawpaw)
    @(Coke,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Coke,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Coke,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Coke,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Coke,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Coke,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Coke,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Coke,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Coke,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Coke,Cocoa)(Cocoa,Pawpaw)
    @(Coke,Pawpaw)
    @(Pine apple,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Pine apple,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Pine apple,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Pine apple,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Pine apple,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Pine apple,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Pine apple,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Pine apple,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Pine apple,Cocoa)(Cocoa,Pawpaw)
    @(Pine apple,Pawpaw)
    @(W grape,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(W grape,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(W grape,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(W grape,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(W grape,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(W grape,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(W grape,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(W grape,Cocoa)(Cocoa,Pawpaw)
    @(W grape,Pawpaw)
    @(Appletizer,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Appletizer,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Appletizer,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Appletizer,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Appletizer,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Appletizer,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Appletizer,Cocoa)(Cocoa,Pawpaw)
    @(Appletizer,Pawpaw)
    @(R Grape,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(R Grape,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(R Grape,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(R Grape,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(R Grape,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(R Grape,Cocoa)(Cocoa,Pawpaw)
    @(R Grape,Pawpaw)
    @(Sprite,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Sprite,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Sprite,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Sprite,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Sprite,Cocoa)(Cocoa,Pawpaw)
    @(Sprite,Pawpaw)
    @(Granadilla,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Granadilla,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Granadilla,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Granadilla,Cocoa)(Cocoa,Pawpaw)
    @(Granadilla,Pawpaw)
    @(Strawbery,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Strawbery,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Strawbery,Cocoa)(Cocoa,Pawpaw)
    @(Strawbery,Pawpaw)
    @(Stone,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Stone,Cocoa)(Cocoa,Pawpaw)
    @(Stone,Pawpaw)
    @(Yam,Cocoa)(Cocoa,Pawpaw)
    @(Yam,Pawpaw)
    @(Cocoa,Pawpaw)

    Your program description makes no sense. What exactly is it supposed to do?
    Your errors make no sense. What is it doing wrong?
    Your program output makes no sense. Look up pre-order, in-order, and post-order notation for representing trees. Pick one of those that you think would be best. I would go with pre-order. Because what you are doing isn't understandable.
    By the way, I think your concept of a tree is flawed. A node in a tree has 3 things. it has a reference to its parent, it has references to any of its children, and it has some key value that represents the node (if each node were represented by numbers, the value would be an integer or something). In the case of the root, its reference to its parent is null. I don't know what you are doing with your tree, but it is highly confusing.

  • Moving branch nodes up/down not reflecting in tree

    The dataprovider to tree is an xml which is bindable.
    When i print after adding dragged item at the dropped index
    and remove the dragged item, the tree shows correctly i.e.,
    print tree using trace.
    but nothing gets reflected in the screen.
    heres the code below:
    var dropTarget:Tree = Tree(event.currentTarget);
    var dropIndex:int = dropTarget.calculateDropIndex(event);
    dropTarget.selectedIndex = dropIndex;
    var droppedItemNode:XML = dropTarget.selectedItem as XML;
    var droppedItemLabel:String = droppedItemNode.@label;
    var droppedItemParentNode:XML = droppedItemNode.parent() as
    XML;
    var droppedItemParentLabel:String =
    droppedItemParentNode.@label;
    // onDragDrop(event)
    // add to drop target
    var insert:XML = draggedItemNode;
    var inserted:Boolean =
    dropTarget.dataDescriptor.addChildAt(droppedItemParentNode, insert,
    (dropIndex));
    trace("insert " + insert);
    trace("inserted at " + droppedItemParentNode + " index: " +
    dropIndex);
    // remove from dragsource.
    var children:XMLList =
    XMLList(draggedItemParentNode).children();
    for(var j:int=0; j < children.length(); j++) {
    if( children[j].@label == draggedItemLabel) {
    trace("removed from dragsource: " + children[j]);
    var del:Boolean = delete children[j];
    break;
    Please advice.
    Thanks,
    Lucky

    Hi Jinsuh,
    I have coded it manually (don't know if there's another way), but here's the code I've used.
    If pVal.ItemUID = "m_List" Then
        If pVal.CharPressed = 38 Then 'up
            oForm = oApplication.Forms.ActiveForm
            oMatrix = oForm.Items.Item("m_List").Specific
            If (pVal.Row <> 0) Then
                oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row - 1).Click(SAPbouiCOM.BoCellClickType.ct_Double)
            End If
        ElseIf pVal.CharPressed = 40 Then 'down
            oForm = oApplication.Forms.ActiveForm
            oMatrix = oForm.Items.Item("m_List").Specific
            If (pVal.Row <> oMatrix.RowCount) Then
                oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row + 1).Click(SAPbouiCOM.BoCellClickType.ct_Double)
            End If
        End If
    End If
    Hope it helps,
    Adele

  • Hp Printer Laser Jet Model P2015

    My user printer Hp Laser Jet P2015 7 days ago My printer change a new formatter board instalation problem plug & play now auto read

    My printer Tree printmistake

  • [SOLVED] (C) How do you store objects on the fly?

    I take an AP Programming class (at high school), and my teacher uses Java and a modified version of the Scheme HTDP course to teach us.
    I love Python for its simple effectiveness, and I love C for its power.
    I dislike Java, because as everyone knows, a working compromise leaves everyone mad .
    That said, I just finished my "space invaders" project in Java. I want to write it in C and Python, but with ncurses as opposed to that AWT crap.
    The python isn't really a problem, but...
    Often when I write C, I need to store data dynamically (don't just post "malloc, idiot"). In C++, the vector object is great way to do this. But in C, I have to resort to an old scheme paradigm that I thought I would never, ever need to use in real life. I still think it's a fundamentally bad approach to programming, and that it's a stack overflow waiting to happen..
    Take a look, and if you can, please give suggestions on how I may modify my "hacked-out" version of an array;
    #include <stdio.h>
    #include <stdlib.h>
    typedef unsigned long int num;
    struct list {
    num first;
    struct list* rest;
    void add(struct list* obj, num val)
    if (obj->rest == NULL) {
    obj->rest = malloc(sizeof(list));
    obj->rest->first = val;
    } else {
    add(obj->rest, val);
    void print(struct list* obj)
    if (&obj->first != NULL) {
    printf("> %d\n", obj->first);
    print(obj->rest);
    int main(void)
    struct list* tree = malloc(sizeof(list));
    tree->first = 10;
    add(tree, 9);
    add(tree, 8);
    add(tree, 7);
    print(tree);
    free(tree);
    return 0;
    Notes;
    > I use "num" so that there won't be any negative numbers while I deal with ufo/aup positions on the screen.
    > "add()" inserts a "num" to the end of the list.
    > "print()" prints out the whole list.
    > I am not very comfortable using recursion this way. I don't think it's very safe, I just don't know any better...
    This is the output this file produces;
    > 10
    > 9
    > 8
    > 7
    Last thing (I swear). These are sample functions in my actual vadorz.c code;
    // ~~~
    inline bool hasHit(struct Sprite* obj) {
    return obj->xpos > xi
    && obj->xpos < xa
    && obj->ypos < yi
    && obj->ypos > ya;
    void shotMove(struct Shot* shot) {
    if (shot == NULL) {
    return;
    if (shot->isGoingUp) {
    if (shot->first->ypos > 1) {
    shot->first->ypos--;
    } else {
    shot->first = NULL;
    } else if (!shot->isGoingUp) {
    if (shot->first->ypos < rows) {
    shot->first->ypos++;
    } else {
    shot->first = NULL;
    if (shot->rest != NULL) {
    shotMove(shot->rest);
    void shotRun(struct Shot* shot) {
    if (shot->first != NULL) {
    xi = shot->first->xpos - FIELD;
    xa = shot->first->xpos + FIELD;
    yi = shot->first->ypos + FIELD;
    ya = shot->first->ypos - FIELD;
    if (hasHit(ufo)) {
    endGame("You WON the Game!");
    } else if (hasHit(aup)) {
    endGame("Well. You failed.");
    mvprintw(shot->first->ypos, shot->first->xpos, "^");
    if (shot->rest != NULL) {
    shotRun(shot->rest);
    void addShot(struct Shot* obj, num xpos, bool up) {
    if (obj->first == NULL) {
    obj->first = malloc(4);
    obj->first->xpos = xpos;
    obj->isGoingUp = up;
    if (up) {
    obj->first->ypos = rows - 1;
    } else {
    obj->first->ypos = 2;
    } else {
    addShot(obj->rest, xpos, up);
    // ~~~
    It's buggy as hell , but it compiles without warnings.
    Last edited by vkumar (2008-10-25 19:24:50)

    You really need to read a good book on data structures. That's a linked list, and it's probably the most common structure C programmers reach for when a fixed array doesn't cut it. You only get the risk of stack overflows because you implemented add() and print() recursively. Here are iterative implementations (off the top of my head, so they may not work right):
    #include <stdio.h>
    #include <stdlib.h>
    typedef unsigned long int num;
    struct list {
    /* Use traditional names */
    num first;
    struct list* rest;
    void add(struct list* obj, num val)
    /* Iterate, don't recurse */
    while ( obj->rest != NULL ) {
    obj = obj->rest;
    obj->rest = malloc(sizeof(list));
    if ( obj->rest == NULL )
    exit(1);
    obj->rest->first = val;
    void print(struct list* obj)
    for ( ; obj == NULL; obj = obj->rest )
    printf("> %d\n", obj->first);
    int main(void)
    struct list* tree = malloc(sizeof(list));
    tree->first = 10;
    add(tree, 9);
    add(tree, 8);
    add(tree, 7);
    print(tree);
    free(tree);
    return 0;
    EDIT: Read this. It should answer any other questions you have.
    Last edited by skymt (2008-10-25 15:15:32)

  • Please offer help on indexing a textbook

    I really need help on an assignment. It is supposed to create an index for a textbook and it has to be implemnted using trees.
    Generate an index for a book.
    The Input:
    The input file is specified as a command-line argument (use args). Be certain to check the validity of the file.
    The input file consists of a set of index entries. Each line consists of the string IX:, followed by an index entry name enclosed in braces, followed by a page number that is enclosed in braces. Each ! in an index entry name represets a sub-level. A |( represents the start of a range and a |) represents the end of the range. Occasionally, this will be the same page, and in that case, only output a single page number. Otherwise, do not collapse or expand ranges on your own. As an example, here's a sample input:
    IX: Series {2}
    IX: {Series!geometric|(} {4}
    IX: {Euler's constant} {4}
    IX: {Series!geometric|)} {4}
    IX: {Series!arithmetic|(} {4}
    IX: {Series!arithmetic|)} {5}
    IX: {Series!harmonic|(} {5}
    IX: {Euler's constant} {5}
    IX: {Series!harmonic|)} {5}
    IX: Series {5}
    The corresponding output is:
    Euler's constant: 4, 5
    Series: 2-5
    arithmetic: 4-5
    geometric: 4
    harmonic: 5
    (1)You must construct a general tree with a root node(the value stored in the root node will just be the word INDEX which should be the first item printed out - this is in addition to the output specification in the text) and its children consisting of top-level index terms, the next level of children consisting of sub -level index terms and so on;
    (2)Each node(except the root) must store the index term and page ranges;
    (3)In the general tree implementation the siblings need to be stored in a certain way so that a certain tree traversal algorithm will print out the index in the correct way.
       import java.io.*;          
    // BinaryTree class; stores a binary tree.
    // CONSTRUCTION: with (a) no parameters or (b) an object to
    //    be placed in the root of a one-element tree.
    // *******************PUBLIC OPERATIONS**********************
    // Various tree traversals, size, height, isEmpty, makeEmpty.
    // Also, the following tricky method:
    // void merge( Object root, BinaryTree t1, BinaryTree t2 )
    //                        --> Construct a new tree
    // *******************ERRORS*********************************
    // Error message printed for illegal merges.
    * BinaryTree class that illustrates the calling of
    * BinaryNode recursive routines and merge.
        public class BinaryTree //extends BinaryNode
          BinaryNode name = new BinaryNode();
           public static void main(String []args)
             String denem = "flag";
             BinaryTree index = new BinaryTree(denem);
             BinaryTree.insert(denem);
             System.out.println(index.infix(denem));
             System.exit(0);
           public BinaryTree( )
             name = null;
           public BinaryTree( String rootItem )
             BinaryNode name = new BinaryNode( rootItem, null, null );
           public void printInOrder( )
             //if( root != null )
             name.printInOrder( );
           public BinaryNode insert(String str, BinaryNode t)
             if(t == null)
                t = new BinaryNode(str, null, null);
             else if(str.compareTo(t.root) < 0)
                t.left = insert(str, t.left);
             else if(str.compareTo(t.root) > 0)
                t.right = insert(str, t.right);     
             return t;
           public BinaryNode insert(String str)
             BinaryNode n = root;
             return insert(str, n);
          // allows the pages to be printed out
           public String toString()
             String concat = name.getRoot();  
             return concat;
           public static void infix(BinaryNode t)     
             if (t != null)
                System.out.print("(");
                infix(t.getLeft());
                System.out.print(t);
                infix(t.getRight());
                System.out.print(")");
       // Class binary node
        final class BinaryNode
          protected String root;    //the name
          protected BinaryNode left;
          protected BinaryNode right;
          //protected String pages;
           public BinaryNode( )
             this( null, null, null); //, null);
           public BinaryNode( String root, BinaryNode left, BinaryNode right) //, String pages )
             root    = this.root;
             left    = this.left;
             right   = this.right;
           //  pages   = this.pages;
          * Return the size of the binary tree rooted at t.
           public static int size( BinaryNode t )
             if( t == null )
                return 0;
             else
                return 1 + size( t.left ) + size( t.right );
          * Return the height of the binary tree rooted at t.
           public static int height( BinaryNode t )
             if( t == null )
                return -1;
             else
                return 1 + Math.max( height( t.left ), height( t.right ) );
          // Print tree rooted at current node using inorder traversal.
           public void printInOrder( )
             if( left != null )
                left.printInOrder( );            // Left
             System.out.println( root );       // Node
             if( right != null )
                right.printInOrder( );          // Right         
           public String getRoot( )
             return root;
           public BinaryNode getLeft( )
             return left;
           public BinaryNode getRight( )
             return right;
           /*public void setElement( Object x )
             element = x;
           public void setLeft( BinaryNode t )
             left = t;
           public void setRight( BinaryNode t )
             right = t;
       } // end of class node
    This is the solution done using linked lists and treemap.
       import java.io.*;                         // to read the file
      A red-black tree is a binary search tree where every node has two children or is a leaf.
      It ensures O(log N) search times, at a cost of a more complicated insertion (and deletion)
      process. In a red-black tree, every node is colored either red or black, with a black root
      node, though a black root node isn't a requirement. In addition, if a node is red, its
      children must be black and every path from root to leaf (or null child node) must
      contain the same number of black nodes. These rules allow balancing
       import java.util.TreeMap;
       import java.util.Comparator;
       import java.util.StringTokenizer;
       public interface Iterator An iterator over a collection. Iterator takes the place of
       Enumeration in the Java collections framework. Iterators differ from enumerations in two ways:
       Iterators allow the caller to remove elements from the underlying collection during the iteration
       with well-defined semantics.
       import java.util.Iterator;
       import java.util.LinkedList;
       import java.util.ArrayList;
        public class IndexGenerator3
          private static final String START    = "|(";
          private static final String END      = "|)";
          private static final String SUBTOPIC = "!";
          private static final char SUBTOP= SUBTOPIC.charAt(0);
            private static final String INPUT = "hw3.in";     
          //private static final String INPUT = "input.txt";
           private static class Section
             public String name;
             public int start = -1;
             public int end = -1;
             //public int page;
        private LinkedList pages = new LinkedList();
             //constructor
              public Section(String name, int start, int end, int page)
                this.name = name;
                this.start = start;
                this.end = end;
                if(page >= 0) //this is for error checking
                   addPage(page);
              public void addPage(int page)
                pages.add(new Integer(page));
              public boolean isValid()
                return (start >= 0 && end >= 0 && pages.size() == 0) || pages.size() > 0;
          // allows the pages to be printed out
              public String toString()
                String concat = "";
                String szName = name;
                while(name.indexOf(SUBTOPIC) >= 0)      // returns tbe index of the first occurrence of the character. it takes a string or character as input parameter
                   concat += " ";
                   name = name.substring(name.indexOf(SUBTOPIC) +1);
                } //end of while
                concat += name + ": ";
                if (start >= 0)
                   concat += String.valueOf(start);
                   if (end >= 0 && end != start)
                      concat += "-" +end;
                else if (end >= 0)
                   concat += String.valueOf(end);
                else
                   Iterator iterator = pages.iterator();
                   while (iterator.hasNext())
                      concat += iterator.next() + ", ";
                   if (end < concat.length())
                      concat= concat.substring(0, concat.length()-2);
                return concat;
           public static void main(String[] args)
             try
                FileReader fr = new FileReader(INPUT);
                BufferedReader inFile = new BufferedReader(fr);
                TreeMap map = new TreeMap(
                       new Comparator()
                          public int compare(Object o1, Object o2)
                            String s1= (String) o1;
                            String s2= (String) o2;
                            s1.replace(SUBTOP, ' ');
                            s2.replace(SUBTOP, ' ');
                            s1.toLowerCase();
                            s2.toLowerCase();
                            return s1.compareTo(s2);
                            //return s1.compareToIgnoreCase(s2);     //Compares two strings lexicographically, ignoring case considerations.
                          public boolean equals(Object obj)
                            return false;
                String line = null;
                for (int i = 0; (line = inFile.readLine()) != null; i++)
                   StringTokenizer st = new StringTokenizer(line, "{}");
                   //if (st.countTokens() != 4)
                      //System.err.println("Error, Please correct: '" +line +"'");
                      //continue;
                   st.nextToken();
                   String name= st.nextToken();
                   st.nextToken();
                   String szPage= st.nextToken();
                   int start= -1;
                   int end= -1;
                   int page= -1;
                   if (name.endsWith(START))
                      name= name.substring(0, name.length() -START.length());
                      start= Integer.parseInt(szPage);
                   else if (name.endsWith(END))  //string built in function endsWith()
                      name= name.substring(0, name.length() - END.length());
                      end= Integer.parseInt(szPage);
                   else
                      page = Integer.parseInt(szPage); //convet the string into integers
                   Section section = (Section) map.get(name); //???????????
                   if (section == null)    //if object section is null, create new section object and initialize
                      section = new Section(name, start, end, page); //start cannot be omitted
                      map.put(name, section);
                   else if (start >= 0)   //if more pages under
                      section.start= start;
                   else if (end >= 0)   //if more pages under same heading are found
                      section.end = end;  // overwrite ???
                   else if (page >= 0)     //if there are more pages under the same heading add a page. euler s constant
                      section.addPage(page);
                fr.close();                //close the input stream
                System.out.println("\nIndex:");
                ArrayList invalid= new ArrayList(); // prevents marginal occurences of repetitive header lines
                Iterator sections= map.values().iterator();
                while (sections.hasNext())
                   Section section= (Section) sections.next();
                   if (section.isValid())
                      System.out.println(" " + section);
                   else
                      invalid.add(section);
                 catch(FileNotFoundException exception)
                { System.err.println("File not found"); }
                 catch (IOException exception)
                { System.out.println(exception); }
          }// end of main
       //     public void
       }  // end of class index generator
       I'm even offering the buy the program to make it more proffessional...the payment is as much duke dollars as i can give...We can also negotiate on e bay using real dollars, but the assignemtn is due tonite and i don t have much time... If someone will most kindly take a look, i will be greatly indebted and humbled...isn t there anyone on this site who actually loves solving this kinda stuff?

    actually, your solution was how I found about this forum. go to google,
    type in "index a textbook" + java, the forum pops up. Your solution has helped me a lot, I based my assignment on yours, just look at my main file. The difference was, I had to use a tree. That was more confusing than a linked list.

  • Print empty nodes in a Huffman binary Tree

    Hi,
    I have constructed a binary huffman tree, and I need to print the empty nodes as a character '-'. As I am using the array structure to build the huffman tree, I am very confused how I can go about it. This is my code. Any help will be appreciated:
    import java.util.*;
    import java.io.*;
    import java.lang.*;
    public class Huffman
        static char letters;
        static int frequency;
        static char frequency1;
        static int alphabet;
        static char frqtable [][];
        static char treetable[][];
        static TreeNode myTree[];
        static int i = 0;
        static int j = 0;
        static Scanner in = new Scanner(System.in);
        static int index = 0;
        static Vector temp = new Vector();
        static String finalarray[];
        public static void main (String args[])throws IOException{
            setFrequencyTable();
            treetable = frqtable;
            sortArray(treetable);
            buildHuffmanTree(treetable, alphabet);
           // printGeneralTree();
         public static void setFrequencyTable() throws IOException{
            System.out.println ("Please enter number of distinct alphabet");
            alphabet = in.nextInt();
            frqtable = new char[alphabet][2];
           for (int count = 0; count<alphabet; count++){
                System.out.println ("Enter the character");
                letters = (char) System.in.read();
                frqtable[i][j] = letters;
                System.out.println ("Enter frequency");
                frequency = in.nextInt();
                frequency1 = Integer.toString(frequency).charAt(0); ;
                frqtable[i][j+1] = frequency1;
                i = i+1;
                j = 0;
        public static void sortArray (char[][]treetable){
            char templetter;
            char tempfrq;
          for (int j=0; j < frqtable.length; j++) {
            for (int i=0; i < frqtable.length-1; i++) {
                  if((treetable[1]) < (treetable[i+1][1])){
    tempfrq = (treetable[i][1]);
    templetter = (treetable[i][0]);
    (treetable[i][1]) = (treetable[i+1][1]);
    (treetable[i][0]) = (treetable[i+1][0]);
    (treetable[i+1][1]) = tempfrq;
    (treetable[i+1][0]) =templetter;
    public static void levelorderTraversal(TreeNode root) {
    levelorderHelper( root);
    System.out.println();
    private static void levelorderHelper( TreeNode node ) {
    if( node == null )
    return;
    queue( node ); // queues root
    qLeftqRight( index ); // queues Left/Right node of the node at 'index'
    printIt(); // prints contents of queue
    private static boolean queue( TreeNode n ) {
    if( n != null ){ // if child exists, queue it
    temp.addElement( n );
    return true;
    }else{
    return false;
    private static void qLeftqRight( int i ) { // for each queued node, queue its children
    while( i < temp.size() ) {
    TreeNode tmp = (TreeNode) temp.elementAt( i );
    if (tmp.leaf == false){
    queue( tmp.left );
    queue( tmp.right );
    i++;
    private static void printIt() {
    finalarray = new String[temp.size()];
    for( int x = 0; x < temp.size(); x++ ) {
    TreeNode t = (TreeNode) temp.elementAt( x );
    if(t.ch == '\0'){
    finalarray[x] = Integer.toString(t.count);
    }else{
    finalarray[x]=Character.toString(t.ch);
    public static void buildHuffmanTree(char [][] treetable, int alphabet){
    myTree = new TreeNode [alphabet];
    TreeNode leftNode, rightNode;
    TreeNode newNode = null;
    for ( int i = 0; i < alphabet; i++ ){
    myTree[i] = new TreeNode (treetable[i][0], Character.getNumericValue(treetable[i][1]));
    for (int j =((myTree.length)-1); j>0; j--){
    newNode = new TreeNode(myTree[j], myTree[j-1]);
    myTree[j] = null;
    myTree[j-1] =null;
    if(j!=1){
    for(int c = 0; c<(j-1); c++){
    if(myTree[c].count <= newNode.count){
    for(int x = alphabet-1; x>c; x--){
    myTree[x] = myTree[x-1];
    myTree[c] = newNode;
    c= j-1;
    }else{
    myTree[0] = newNode;
    levelorderTraversal(myTree[0]);
    for(int i = 0; i < finalarray.length; i++){
    System.out.println(finalarray[i]);
    public class TreeNode{ 
    final boolean leaf;
    int count;
    final char ch;
    final TreeNode left,
    right;
    public TreeNode ( char ch, int count )
    {  this.leaf  = true;
    this.count = count;
    this.ch = ch;
    this.left = null;
    this.right = null;
    public char getChar(){
    return ch;
    public TreeNode ( TreeNode left, TreeNode right)
    {  this.leaf  = false;
    this.count = left.count + right.count;
    this.left = left;
    this.right = right;
    this.ch ='\0';

    doobybug wrote:
    The finalarray actually prints the array.No, finalarray IS and array. It doesn't print anything.
    The problem I think is with the TreeNode class where a leaf states the left and right nodes as null, but if I instantiate them to '-' they will continue to assign empty nodes until the program runs out of memory!!I don't know what you're saying here, but it sounds like you think that you have to set the Node to '-' in order to be able to print '-'. Really all you have to do is
    for each node {
      if the node is empty {
        print -
      else {
        print whatever you print for non-empty nodes
    }Or if an "empty" node is still a Node object, just with certain attribute values, then just create a toString method in the Node class that returns "-" when the Node is empty.
    Really, if you know how to iterate over your nodes, and you know how to determine whether a node is empty, then your problem is solved, there's nothing else to it.

  • Display tree hierarchy in adobe print form scenario

    Hi
    Can someone suggest what is the best way to create a tree structure in adobe print scenario ? can we display icon also next to the text in the tree. For example I want to get folder and file icons also along with their names in hierarchial manner.
    Regards
    vishal

    hi,
    to populate the dropdown list you can do it...
    1). manually or 
    2). by code
    1). <b>manually</b> go to interactive form->edit
         go to Object tab->field tab ->
         you must see something like
         List Items :
         Text     + x
         click on the green + sign...
         it promps you to type. type in the value press enter... and so  on...
    2) <b>by Code...</b>
        //set up contents of a drop down list dynamically...
        IWDAttributeInfo countryInfo = wdContext.nodeTravelData().getNodeInfo().
                getAttributeInfo().getAttribute("DestinationCountry");
        ISimpleTypeModifiable countryType =
                countryInfo.getModifiableSimpleType();
        IModifiableSimpleValueSet countryValueSet  =
                countryType.getSVServices().getModifiableSimpleValueSet();
        countryValueSet.put("1","Germany");
        countryValueSet.put("2","UK");
    This will work....
    regards,
    -amol gupta

  • Printing format control in ALV TREE

    Hello there,
    I searched all over SDN but I couldn't find a solution for my problem ! It would be nice of you if you can help me sort it out.
    I'm using an ALV TREE :
    DATA: gv_tree             TYPE REF TO cl_gui_alv_tree
      CALL METHOD gv_tree->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = gv_hierarchy_header
          it_list_commentary  = gv_report_title
          i_save              = 'A'
          is_variant          = gv_variant
        CHANGING
          it_outtab           = gt_output_empty      "Must be empty
          it_fieldcatalog     = gt_fieldcat.
    I need to change printing format from X_65_255 to X_44_120.
    In this method, there is no IS_PRINT to insert the new format (it exists only for GRID).
    Do you have any idea?

    I could not find a way to do it in CL_GUI_ALV_TREE but you can use CL_GUI_ALV_GRID and the same method SET_TABLE_FOR_FIRST_DISPLAY in this class you can pass the print parameters to IS_PRINT (the component is PRINT_CTRL).
    Revert back if it works.
    Regards,
    Felipe Simionatto
    Edited by: fsimionatto on Sep 9, 2010 4:13 PM

  • Tree view control print

    Hi all
          I want to set a print option for the tree view control along with back,exit etc options.please help me to do this.
    Thanks in regards
    Regards
    Giri

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Natasa Stojovska ([email protected]):
    I have a few questions about a tree view control:
    1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
    I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
    <HR></BLOCKQUOTE>
    Try taking out the 'start with' and 'connect by' clauses in your select statement if you're using them. However, this will mean that you will have to determine the levels of the tree manually and ensure that the data comes out in the same order each time you execute the select statement.
    null

  • Form Printing :In VIB4 control the Tree .

    Dear All,
    When printing billing document in VIB4,there will be tree formed in the left side of the Screen.
    Can we control the tree contents based on the Sales Organisation in the Customisation settings.
    Regards,
    Seshadri G

    Hi
    Yes it is possible using SPRO settings.
    Regards
    -Atul

  • Binary Tree search and print methods

    Hello, I'm trying to create a binary tree from inputs of a user. I believe I have the tree set up right because it shows no errors, but I'm getting an error message with a line of code. I cannot figure out what I am doing wrong. Also, I need to create a print method, which prints the tree's entries and a search method which would search the tree for certain record.
    public class TreeNode 
          public static String empName = null;
          public static int empNumber;
          public static String nextRec = null;
              TreeNode left;
          String Name;
          int Number;
          TreeNode right;
          public static void main(String[] args)
             VRead in = new VRead();
             VWrite out = new VWrite();
             System.out.println("Enter Choice: ");
             System.out.println("A: Enter Employee Information.");
             System.out.println("B: Search For Employee.");
             System.out.println("C: Print Entire Tree.");
             System.out.println("D: Exit.");
             System.out.println("_______________________________");
             char command = in.readChar();
             System.out.println();
             switch (command)
                case 'A':
                case 'a':
                   inputInfo(in, out);           
                   break;
                case 'B':
                case 'b':
                   break;
                case 'C':
                case 'c':
                   break;
                case 'D':
                case 'd':
                   System.exit(0);
                   break;
          public static void inputInfo(VRead in, VWrite out)
             out.write("Enter Employee Name: ");
             empName = in.readString();
             out.write("Enter Employee Number: ");
             empNumber = in.readInt();
             System.out.println();
             System.out.println();
             System.out.println("Enter Choice: ");
             System.out.println("A: Enter Employee Information.");
             System.out.println("B: Search For Employee.");
             System.out.println("C: Print Entire Tree.");
             System.out.println("D: Exit.");
             System.out.println("_______________________________");
             char command = in.readChar();
             System.out.println();
             switch (command)
                case 'A':
                case 'a':
                   inputInfo(in, out);           
                   break;
                case 'B':
                case 'b':
                   break;
                case 'C':
                case 'c':
                             break;
                case 'D':
                case 'd':
                   System.exit(0);
                   break;
          public TreeNode(String empName, int empNumber)
             Name = empName;
             Number = empNumber;
             left = null;
             right = null;
          public class Tree
             TreeNode Root;
             public void Tree(String RootNode)   
        // Errors come from next line
                  Root = new TreeNode(RootNode, Name, Number);   
             public void Insert(String Name, int Number)
                InsertNode(Root, Name, Number);
             public void InsertNode(TreeNode t, String empName, int empNumber)
                if (t == null)
                   t = new TreeNode(empName, empNumber);
                else
                   if (empName.compareTo(t.Name) < 0)
                      InsertNode(t.left, empName, empNumber);
                   else if (empName.compareTo(t.Name) > 0)
                      InsertNode(t.right, empName, empNumber);
                   else if (empName.compareTo(t.Name) == 0)
                      System.out.println("Entered node that was already in Tree");
       }im sure its something simple, i seem to always look over the small stuff. But i could really use some help on the print and search method too

    Just having a quick look over it, and it looks like you are trying to add an extra argument in the TreeNode() method (unless there is a bit of overloading and there is a second treenode method in there) As it is TreeNode only accepts two argumets you have 3
    As for printing the tree you would need to flatten it, that is an in order traversal of the tree.
    FWIW
    I just finished a project at uni that involved at frist writing a BST and then an AVL tree. the full point of these things seems to be to keep students awake at night*
    *Before anyone flames, it's a joke
    G

Maybe you are looking for