Fill the child node in create
Hi, i want create new row, all work fine, i can fill the header node and it´s record in the backend... but, how can fill the child node?
My code for create a row is:
// add a new item
// first an empty synbo is created and than the values are set
public void addRowInDB(String syBName, String[] newValues) throws SmartSyncException, PersistenceException {
String syncBoName = syBName;
SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);
SmartSyncTransactionManager transactionManager;
RowDescriptor sbdRowDesc = sbd.getTopRowDescriptor();
// Create new syncbo
SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);
Row worker = newsyncBo.getTopRow();
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("BSTNK"),newValues[0]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNAG"),newValues[1]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNWE"),newValues[2]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNRG"),newValues[3]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNZV"),newValues[4]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("AUART"),newValues[5]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("BSARK"),newValues[6]); Date d = new Date(2008, 10, 10);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("ERDAT"),d);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("ERNAM"),newValues[8]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("VKORG"),newValues[9]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("VTWEG"),newValues[10]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("SURTIDO_COMPLETO"),newValues[11]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("TEMPORADA"),newValues[12]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("COLECCION"),newValues[13]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("TEMA"),newValues[14]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("SPART"),newValues[15]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("AUGRU"),newValues[16]); worker.setFieldValue(sbdRowDesc.getFieldDescriptor("NOTAS"),newValues[17]);
dataFacade.insertSyncBo(newsyncBo);
With this code only can fill the header, how can fill the child?
Thanks,
Hello, lot of thanks...
Finally i can insert the root and the child in my DB SQL Studio... and i can see the data... But, when sync, no send the data, and not appear errors, and not appear block queue... What happend?
My code is:
SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);
SmartSyncTransactionManager transactionManager;
RowDescriptor sbdRowDesc = sbd.getTopRowDescriptor();
// Create new syncbo
SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);
Row worker = newsyncBo.getTopRow();
transactionManager = dataFacade.getSmartSyncTransactionManager();
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("BSTNK"),newValues[0]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNAG"),newValues[1]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNWE"),newValues[2]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNRG"),newValues[3]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("PKUNZV"),newValues[4]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("AUART"),newValues[5]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("BSARK"),newValues[6]); Date d = new Date(2008, 10, 10);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("ERDAT"),d);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("ERNAM"),newValues[8]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("VKORG"),newValues[9]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("VTWEG"),newValues[10]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("SURTIDO_COMPLETO"),newValues[11]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("TEMPORADA"),newValues[12]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("COLECCION"),newValues[13]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("TEMA"),newValues[14]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("SPART"),newValues[15]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("AUGRU"),newValues[16]);
worker.setFieldValue(sbdRowDesc.getFieldDescriptor("NOTAS"),newValues[17]);
dataFacade.insertSyncBo(newsyncBo);
Row row = newsyncBo.createEmptyRow(sbd.getRowDescriptor("010"));
SyncBo so = row.getSyncBo();
RowDescriptor s = sbd.getRowDescriptor("010");
row.setFieldValue(s.getFieldDescriptor("MATNR"),newValues[18]);
row.setFieldValue(s.getFieldDescriptor("J_3ASIZE"),newValues[19]);
Date da = new Date(2008, 10, 10); row.setFieldValue(s.getFieldDescriptor("DT_ENTREGA"),da);
row.setFieldValue(s.getFieldDescriptor("SEMANA"),newValues[21]);
row.setFieldValue(s.getFieldDescriptor("MES"),newValues[22]);
row.setFieldValue(s.getFieldDescriptor("NO_CANTBRUTA"),newValues[23]);
so.insertRow(row);
If i create without the child.. when sync, send the data...
Regards,
Similar Messages
-
How to add a button in the child node of the Tree Table?
Hi All,
I am having a requirement to create a tree table and it should have a delete button to each child node (screenshot attached).
Can anyone provide me a sample for how to implement this.
Thanks in Advance
AravindhHi Aravindhan,
Try something like this:
var ttDesvios = new sap.ui.table.TreeTable();
var cbDesviacion = new sap.ui.commons.CheckBox();
ttDesvios.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Col1"}),
template: new sap.ui.commons.Label({text: "Info"}),
width: "50px",
ttDesvios.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Action"}),
template: new sap.ui.commons.Button({text: "Delete"}).bindProperty("visible", "pathPropertyChild", function(value){
if(value .............){ return true;} //For child
else{ return false;} //For parent
width: "160px",
Regards
EDIT: Wrong paste code, that's better! -
How to fill the configuration data while creating a sales order
Hi,
I am creating Sales order through BAPI_SALESORDER_CREATEFROMDAT2, the order is getting created but I am not getting the characteristic values. I filled the structures required for the configuration part.
If possible please post the code for the config part.
Thanks,
Sarath.Hi,
Here for your reference:
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
salesdocumentin = w_line-vbeln
order_header_in = order_header_in
IMPORTING
salesdocument = salesdocument
TABLES
return = return
order_items_in = order_items_in
order_partners = order_partners
order_schedules_in = schedules_in
order_conditions_in = conditions_in
order_text = order_text.
Rgds,
Jenny -
I am creating a pages document with a table where I have entered merge fields and want the table filled out with data from a numbers spreadsheet. Instead of pulling data and filling the next rows down it is giving me a separate sheet per data. This worked fine in Word/Excel. What am I missing here?
I am creating a pages document with a table where I have entered merge fields and want the table filled out with data from a numbers spreadsheet. Instead of pulling data and filling the next rows down it is giving me a separate sheet per data. This worked fine in Word/Excel. What am I missing here?
-
Hi Everybody,
I have the following Context:
ParentNode
- ChildNode1
-Visible
- ChildNode2
-Visisble
-ChildNode3
-Visible
Similalry, I have 10 Child Nodes. Now I want to access the attribute "Visible" under each Child Node by iterating it. How to do that...?
My Scenario is, I am having 10 Tabs and Each Tab has 20 Tables, these UI elements are designed as static.
Now from R/3 I will receive No.Of tabs to be visible, for Example if TabVisible value is 5, then Only 5 tabas are visible out of 10. Then I will receive No. of Tables to be displayed in Each Tab, for example, in Tab1 - 8 ables; Tab2 - 5 Tables; Tab3-6 Tables. I have set the Visible Contest binded to each UI element. Now I wan to loop it to get the output structure.
So, I hae designed the Context structure as follows:
<b>Tab1</b> <b>(Parent Node)</b>
- <i>Table_1</i> <b> (Child Node)</b>
- Visible <b>(Attributes)</b>
- ColHeader
- <i>Table1_!</i>
-Visible
- ColHeader
- <i>Table2_1</i>
-Visible
-Tab1Visble <b>(Parent Node Attribute)</b>
<b>Tab2</b>
- <i>Table_2</i>
- Visible
It goes on like this...
Please give me solution for the above case...if possible code snippets..
Thanks in advance
Regards/GuruHi Kumara,
According to your specified requirement you have 10 Tabs and each Tab contains 20 Tables. So to control the visibility you first need to assign the Visibility Property of each individual tab/ table to different value nodes of type com.sap.ide.webdynpro.uielementdefinitions.Visibility. To control the visibility of the tables and tabs you can follow the context structure like this.
Tab1 ( Parent Value Node )
|....Visible ( Value attribute for Tab Visiblity )
|..........Table1 ( Child Value Node under Parent Node )
|......Visible ( Value attribute for table Visiblity )
|..........Table2
|......Visible
|..........Table3
|......Visible
|..........Table4
|......Visible
Once you assign the visible property of all your UI elements like (Tables, Tabs) you can very easiliy control the visibility of each individual Tab like Tab1 with the
following code.
wdContext.currentTab1Element().setVisible(WDVisibility.NONE);
and to control the visibility of each table under each Tab for example ( Table1 under Tab1 ) use this following code.
wdContext.createTable1Element().setVisible(WDVisibility.NONE);
I have tried my level best to help you.
Thanks and Regards
Avijit -
How to fetch the child Nodes using XNode
Hi All,
How to fetch child nodes of XNode object ?
I am moving my code to .net 3.5 so i was replacing XMLNode to XNode , but i could find any ChildNodes() method.
Thanks,
PallaviAs such this is not a SharePoint related question, even though there are many way to parse the XNode object.
One way is,
XNode an all other are derived from XElement, so you can use Linq to get all children by casting it with XElement, below is a snippet
XDocument doc = XDocument.Load(""); //Path
XElement ele = doc.Nodes().First() as XElement;//Just taking the first element as XNode
foreach (var item in ele.Elements())
var v = item;
You can use Full Linq queries to find any node, just for example, below is a snipped to find a node based on a attribute value
ele.Elements().Where(x => x.Attribute("text").Value == "text");
get2pallav
Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you. -
Table with DropDownBox with data from child node
Hi,
I have following context:
Node Parent (0..n)
-- Node Child (0..n)
Child Attribute 1
Child Attribute 2
-- Parent Attribute 1
-- Parent Attribute 2
The parent node has a child node with cardinality 0..n. Now I created a table from the Parent node with several columns. In one column is a
DropDownBox that should display the data of the Child node, depending on the Parent node element.
Parent | Parent DropDownBox |
Parent 1 | Parent 1 Child Attribute 1 |
Parent 1 Child Attribute 2
Parent 2 | Parent 2 Child Attribute 1 |
Parent 2 Child Attribute 2
How can I fill the child node with data depending on the parent node element? How is the mapping between both?
IParentElement parentElement;
IChildElement childElement;
while (rs.next()) {
parentElement = wdContext.createParentElement();
parentElement.setAttribute1(rs.getLong("ID"));
parentElement.setAttribute2(rs.getString("SYSTEM"));
wdContext.nodeParent().addElement(parentElement);
while (rs2.next()){
childElement = wdContext.createChildElement();
childElement.setAttribute1(rs2.getLong("ID"));
childElement.setAttribute2(rs2.getString("NAME"));
wdContext.nodeChild().addElement(childElement);
If the child node is non-singleton I have the following option
parentElement.nodeChild.addElement(childElement);
But this doesn't work for singleton nodes. How can I do something similar for singleton nodes?
Thanks for your help,
AndiNot quite correct.
You can add more than one <b>element</b> to a singleton node (if cardinality is *:N).
But a singleton child node exists only once per parent <b>node </b>and not once per parent <b>element</b>.
That's an important difference.
Armin -
Treeview Add Child to Parent Node Without Creating a New Parent
I have a treeview setup with a HierarchicalDataTemplate in my XAML as follows:
<TreeView Grid.Column="1" Grid.Row="0" ItemsSource="{Binding treeViewObsCollection}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding mainNodes}">
<TextBlock Text="{Binding topNodeName}"/>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding subItemName}"></TextBlock>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
Here is the ViewModel which is set as the Data Context for the XAML File.
class AdvancedErrorCalculationViewModel : ViewModelBase
static ObservableCollection<TreeViewClass> _treeViewObsCollection = new ObservableCollection<TreeViewClass>();
public static ObservableCollection<TreeViewClass> treeViewObsCollection { get { return _treeViewObsCollection; } }
public class TreeViewClass : ViewModelBase
public TreeViewClass(string passedTopNodeName)
topNodeName = passedTopNodeName;
mainNodes = new ObservableCollection<TreeViewSubItems>();
public string topNodeName
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public ObservableCollection<TreeViewSubItems> mainNodes { get; private set; }
public class TreeViewSubItems : ViewModelBase
public TreeViewSubItems(string passedSubItemName, string passedSubItemJobStatus)
subItemName = passedSubItemName;
subItemJobStatus = passedSubItemJobStatus;
public string subItemName
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public string subItemJobStatus
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public static void AddTreeViewItems(string passedTopNodeName, string passedChildItemName, string passedChildItemJobStatus)
treeViewObsCollection.Add(new TreeViewClass(passedTopNodeName)
mainNodes =
new TreeViewSubItems(passedChildItemName, passedChildItemJobStatus)
The problem lies with the AddTreeViewItems method
seen above. Currently, if I call the method by let's say:
AdvancedErrorCalculationViewModel.AddTreeViewItems("Parent","Child 1", "Completed");
it creates the parent and child nodes just fine. No issues there.
However, if I call the method again with the same Parent name but a different Child; for example:
AdvancedErrorCalculationViewModel.AddTreeViewItems("Parent","Child 2", "Completed");
It creates a new Parent node with a child node Child 2 instead. Thus, I have something like this:
- Parent
- Child 1
- Parent
- Child 2
I would like to modify this function so that if the parent name is the same, the child node should belong under the previous Parent instead
of under a new Parent node. Something like this:
- Parent
- Child 1
- Child 2
Could anyone help me modify my code to detect if the Parent node exists in the observablecollection already and if so, place the child node under the existing parent? The main problem I am facing is trying to add items to a previously created observable collection
with an existing hierarchy because I don't know how to access the previous observable collection anymore. Help me with this please.
Thanks in advance. :)You need to try and find an existing entry and if it's there add the child to that instead.
I notice you're a student and I guess this is probably an assignment.
By the way.
I suggest you work on the name of your collections and classes there.
EG A class should be singular but way more meaningfull than treeviewsubitem.
Anyhow, finding the top node could be done using linq. Since you can get none, SingleOrDefault is the method to use.
Thus something like:
TreeViewClass tvc = treeViewObsCollection.Where
(x=>x.Title == passedTopNodeName).SingleOrDefault();
Will give you tvc null or the qualifying entry.
If it's null, do what you have now.
If it's not then add the child item to tvc.
tvc is a reference to the TreeViewClass you have in that collection.
Please don't forget to upvote posts which you like and mark those which answer your question.
My latest Technet article - Dynamic XAML -
Modifying child node instances in the foreach loop
Dear All,
I have implemented a custom BO with a child node. On executing an action on the root node, i want to loop through the associated child nodes and create an SAP standard BO instance for every child node instance.
I then want to associate the ID of the standard BO created to a field in the child node.How do i modify the child node instance in this loop?
Any pointers would be really appreciated.
Thanks a lot for your help.
- KavyaHello Kavya,
First you want to lopo over all child nodes
( var myChild in this.Child ) {
Then you create the standard BO
customer = Customer.Create();
Now assign the InternalID to your Child ID
myChild.ChildId = customer.InternalID;
HTH,
Horst -
Find the grand parent of child node
Hi gurus,
I have a table with the following structure
Supp_Num Parent_Num Inidicator
1 Null 0
2 1 1
3 2 1
4 Null 0
5 4 1
For all the parent Nodes the indicator will have '0'
For all the child Nodes the indicator will have '1'.
I want to write a sQL code where i provide a child name and it traces back to its root parent . For eg if i provide the procedure with Supp_Num=3 it should traverse back to 1 and give 1 as output
Thanks in advance9ba2a86d-5f7e-4e53-99ee-d675435c2efd wrote:
Thanks for the reply but i'm expecting Supp_Num =4 as well since its parent for Supp_num=5 . Also i want to write it in a Stored Proc form where i just provide the
Supp_num as input and i get the root parent node as output.
Thanks in advance
You wrote in your original post
I want to write a sQL code where i provide a child name and it traces back to its root parent . For eg if i provide the procedure with Supp_Num=3 it should traverse back to 1 and give 1 as output
And my solution did exactly the same. Now if you want the Root details for SUPP_NUM=5, it will provide the root node for same. See below:
with data as
select 1 supp_num, null par_num, 0 ind from dual union all
select 2 supp_num, 1 par_num, 1 ind from dual union all
select 3 supp_num, 2 par_num, 1 ind from dual union all
select 4 supp_num, null par_num, 0 ind from dual union all
select 5 supp_num, 4 par_num, 1 ind from dual
select *
from (
select supp_num, par_num, ind
from data
start with supp_num = 5
connect by supp_num = prior par_num
where par_num is null;
SUPP_NUM PAR_NUM IND
4 0
You just need to set the START WITH clause with appropriate SUPP_NUM. -
How to open a dialog box while double cliking the JTree child node.
hi
I am new to Swing technology.I want to open a dialog box while double clicking the child node of a tree.Could anyone please send me some examples.mouse listener on the tree, see if the click count is 2 and what node it clicked, open the dialog. MouseEvent can give you the click count and x/y coordinate, JTree can tell you what node is at that coordinate.
-
Problem with childs nodes and automatic key mapping in a Data Object
Hi experts!
I'm doing the service order tutorial from the mobile help at [this link|http://help.sap.com/saphelp_nwmobile71/helpdata/en/21/9b5b924c3b434fba4767731794b029/frameset.htm] and I have a problem...
In the topic "Modeling the Equipment Data Object", says you have to mark the "Automatic Key Mapping" checkbox. So when I had to create a third child node ( the location node ) the system raised an exception with the message "Deselect automatic key mapping flag for more than two-level nodes". I'm trying deselecting the flag and creating the location node, but when I want mark again the automatic key mapping flag, this is disabled.
What can I do to solve this and create the three child nodes with the flag marked? It's a configuration thing?
Any help it's very welcome. Thanks in advance.
Best regards,
Simon.The thing is: Its not allowed to use automatic keymapping if you have more than two levels. This is why the message showed up, and this is why its been disabled.
What automatic keymapping does: Figures out automatically which child node belongs to which parent (by guessing from the field name and type, which fields in the child correspond to which key fields of the parent).
On three levels, this becomes more complicated => Its disabled.
How to do keymapping yourself instead of having the DOE do it automatically: Do 'Explicit keymapping' from each child to its parent. Explicit keymapping is done by clicking on the corresponding menu button in the child node. Here you need to associate child node fields (they need not be key fields of the child, but they are allowed to be that as well) to each of its parent nodes key fields (so that each child can be associated to its parent).
Cheers -
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. -
Regarding : Creation of child nodes in a outlinefield
Hi,
I am facing a few problems in creating a child node. I read elements from an array to populate the outline field. The array has exact definitions as to what should be a parent and child respectively. While I am able to create nodes at the parent level, I am unable to create child nodes for any parent. I discovered that the value for the parent node is getting lost. I have tried to use some of the methods to arrive at the parent node, but to no anvil. Could some one suggest how exactly to get the value of the parent node so that the child node can be assigned to the parent.
Thanks In advance.
Balasubramaniam Sures
[email protected]
P.S : I have seen the examples Simple Outline field and File Browser. No clues from here.I take it that you are traversing through the array and loading each
element into the OutlineField. At the risk of stating the obvious, for
each element you must also identify it's parent. This is necessary to
set the relationship from the child to the parent or vise versa.
If you are already doing this and are still having difficulty, the
problem may be as simple as setting the IsFolder property of the parent
node. Unless this is done, it's child nodes will not be visible.
Van Vuong
Lead Technical Analyst
Office: 972.985.5289
VoiceNow: 972.330.0822
Internet: [email protected]
PAGE NET
From: bala[SMTP:[email protected]]
Sent: Friday, October 03, 1997 12:32 PM
To: '[email protected]'
Subject: Regarding : Creation of child nodes in a outline field
Hi,
I am facing a few problems in creating a child node. I read elements from an
array to populate the outline field. The array has exact definitions as to
what should be a parent and child respectively. While I am able to create
nodes at the parent level, I am unable to create child nodes for any parent.
I discovered that the value for the parent node is getting lost. I have
tried to use some of the methods to arrive at the parent node, but to no
anvil. Could some one suggest how exactly to get the value of the parent node
so that the child node can be assigned to the parent.
Thanks In advance.
Balasubramaniam Sures
[email protected]
P.S : I have seen the examples Simple Outline field and File Browser. No
clues from here. -
Need to chart attribute value of just one child node of XML document
I have a XML document with (for example) 7 parent nodes, each
parent node has 5 child nodes. The parent nodes have an attribute
@EarlierDTS (DateTime type) that is the x-axis category of a chart.
Each child node has an attribute @eventid which specifies the id of
the event, and another atttribute @NumOccurs which specifies how
many times that event occured in that period.
How do I tell Flex I want a simple line chart of the eventID
= 215? What if I want two lines, for both eventID=215 and
eventid=307?
I have studied the posts and blogs for over a week now, and
have seen this question or similar come up quite a few places, with
no answer.
1) Should I focus on learning how to create a filterfunction
for the XMLList that underlies my XMLListCollection so that the
filtered data view is just one child node per parent node ( or two
child nodes for the second case)? And set the filtered data view as
the dataprovider of my chart's vertical series?
2) Should I focus on learning how to create a XML Filter
query that selects just one or two child nodes for each parent
node, and set the charts' series' dataprovider to this filter
expression? (I don't think this is allowed - but I'm checking with
the forum members...)
3) Should I focus on learning how to convert the
XMLListCollection into a HierarchicalData object, and then learning
how to filter this object so there is only one (or two) childs per
parent? This seems like a lot of coding - I almost have to create a
pair of classes - one for the parent and one for the child - so I
can create nested ArrayObjects.
4) Should I create a brand new XMLList by walking the
original XML list, and inserting Parent nodes and just the child
nodes that match the eventID(s) I want to chart, into the new
XMLList?
I believe that the easiest way would be to create a
Filterfunction for the XMLList, and bind the chart series to the
(filtered) XML List. But the problem with this approach is that I
have seen more than 2 posts asking how to accomplish filtering that
removes specific children from the view, with no solutions posted.
Help! What is the best way to get just one child for each
parent, from an XMLList?"whertzing" <[email protected]> wrote in
message
news:[email protected]...
>I have a XML document with (for example) 7 parent nodes,
each parent node
>has 5
> child nodes. The parent nodes have an attribute
@EarlierDTS (DateTime
> type)
> that is the x-axis category of a chart. Each child node
has an attribute
> @eventid which specifies the id of the event, and
another atttribute
> @NumOccurs
> which specifies how many times that event occured in
that period.
>
> How do I tell Flex I want a simple line chart of the
eventID = 215? What
> if I
> want two lines, for both eventID=215 and eventid=307?
>
> I have studied the posts and blogs for over a week now,
and have seen this
> question or similar come up quite a few places, with no
answer.
>
> 1) Should I focus on learning how to create a
filterfunction for the
> XMLList
> that underlies my XMLListCollection so that the filtered
data view is just
> one
> child node per parent node ( or two child nodes for the
second case)? And
> set
> the filtered data view as the dataprovider of my chart's
vertical series?
>
> 2) Should I focus on learning how to create a XML Filter
query that
> selects
> just one or two child nodes for each parent node, and
set the charts'
> series'
> dataprovider to this filter expression? (I don't think
this is allowed -
> but
> I'm checking with the forum members...)
>
> 3) Should I focus on learning how to convert the
XMLListCollection into a
> HierarchicalData object, and then learning how to filter
this object so
> there
> is only one (or two) childs per parent? This seems like
a lot of coding -
> I
> almost have to create a pair of classes - one for the
parent and one for
> the
> child - so I can create nested ArrayObjects.
>
> 4) Should I create a brand new XMLList by walking the
original XML list,
> and
> inserting Parent nodes and just the child nodes that
match the eventID(s)
> I
> want to chart, into the new XMLList?
>
> I believe that the easiest way would be to create a
Filterfunction for the
> XMLList, and bind the chart series to the (filtered) XML
List. But the
> problem
> with this approach is that I have seen more than 2 posts
asking how to
> accomplish filtering that removes specific children from
the view, with no
> solutions posted.
>
> Help! What is the best way to get just one child for
each parent, from an
> XMLList?
I'd just look at a dataFunction. There's an example here that
may point you
in the right direction:
http://flexdiary.blogspot.com/2008/08/charting-example.html
HTH;
Amy
Maybe you are looking for
-
I have downloaded the new iTunes 10.7 on my computer with windows vista on it. Now every time I try to run a video it shuts off iTunes. Is anyone else having this problem? I have uninstalled and reinstalled the program twice. Is there a fix? Is it po
-
How do I create an entire class as a long video with quizzes every now and then.
I am creating classes documentary video style. I would like my students to watch them and take quizzes at certain points in the video to make sure they are watching. I also want to control their playback. I can't have them skipping forwards, yet I w
-
The error showing as Fiscal year change has not carried out for the coCd
Hi all, I am facing a very critical situation. My client has the last closed fiscal year as 2006(from 2006 april to 2007 march).For the fiscal yr. 2007(2007april to 2008 march) they have already finalised and submitted the reports made from some para
-
How to reverse a PSD file that's combined layers into one layer...
Hi, I'm not quite sure what happened but I had a PSD file I was working on with multiple layers and then I saved a PDF of the file and I think I may of accidentally switched up the files somehow because now my PSD file's layers are all combined into
-
Ok my computer crashed everytime I connected my Zen Touch. It had worked great before for many years. but ok. I decided it probably was the Firmware so I restarted my MP3-player in recovery mode and deleted the firmware. guess what? I couldn't reinst