Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Unique type (Read 5455 times)
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Unique type
Oct 13th, 2009 at 6:03pm
Print Post  
Hi
i am using flow charter sample project

here i am i am using only 3 shapes

start
terminate
and decision
i am getting uniqued id for each node in onnodecretaed event


i want to drag 5 number of decision nodes..is it possible to get uniquetype for each decision shape..that means when i drag a decision node i want to get uniquetype xxx1 and for second node i want to get xxx1 for third i want to get decisionxxx3..

for start we are uing like this
start.Shape=Shapes.Start
start.text= start

how can we assign values for these
xxx1 and xxx2 and xxx3


can you send some exapmlls



cna you please send some sample code
« Last Edit: Oct 14th, 2009 at 4:33am by learner123 »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unique type
Reply #1 - Oct 14th, 2009 at 7:18am
Print Post  
try using this function:

Code
Select All
function getNumNodes(shapeId, diagram)
{
	var c = 0;
	for (i = 0; i < diagram.getNodes().size(); ++i)
		if (diagram.getNodes().get(i).getShape().getId() == shapeId)
			c++;
	return c;
}
 



It assumes all nodes are of the ShapeNode type.
  
Back to top
 
IP Logged
 
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Re: Unique type
Reply #2 - Oct 14th, 2009 at 10:32am
Print Post  
Thanks,

In which event i have to call this function and can explain what it returns
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unique type
Reply #3 - Oct 14th, 2009 at 11:06am
Print Post  
It returns the number of nodes with the specified shape id. You could call it from the NodeCreatedScript, passing args.getNode().getShape().getId() as the first argument and applet.getDiagram() as the second argument.
  
Back to top
 
IP Logged
 
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Re: Unique type
Reply #4 - Oct 14th, 2009 at 1:11pm
Print Post  
HI

tried like this

function onNodeCreated(sender, args)
{
args.getNode().getShape().getId(getNumNodes());;

applet.getDiagram(getNumNodes()) ;
function getNumNodes(shapeId, diagram)
{
var c = 0;
for (i = 0; i < diagram.getNodes().size(); ++i)
if (diagram.getNodes().get(i).getShape().getId() == shapeId)
c++;
document.getElementById("tbid").value=c;
}



but its not return anything..i am not getting any value
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unique type
Reply #5 - Oct 14th, 2009 at 1:37pm
Print Post  
You have a lot to learn indeed. The things between the parentheses in the function declaration are parameters and you should pass respectively the shape id and the diagram instance as arguments when calling the function. E.g. if the control's ID is diagramView, and assuming you keep the "return c;" statement in the function:

var diagram = <%=diagramView.AppletElement%>.getDiagram();
var shapeId = args.getNode().getShape().getId();
var numNodes = getNumNodes(shapeId, diagram);

Now you can concatenate shapeId + numNodes to get something like "Decision3".
  
Back to top
 
IP Logged
 
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Re: Unique type
Reply #6 - Oct 14th, 2009 at 2:33pm
Print Post  
excellent it is working for me

Thanks

var Nodename=shapeId + numNodes;
here i am getting nodename ..but 1 asked you before

for start we are uing like this
start.Shape=Shapes.Start
start.text= "start "

how we can assign values or bind values for
Nodename

please send me any code if you have
thanks for your time
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unique type
Reply #7 - Oct 14th, 2009 at 5:09pm
Print Post  
There is no built-in databinding. You should run a select query, loop over the dataset rows and copy the field values to their corresponding node properties.
  
Back to top
 
IP Logged
 
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Re: Unique type
Reply #8 - Oct 14th, 2009 at 5:14pm
Print Post  
any example or sample code will help me

thanks
  
Back to top
 
IP Logged
 
learner123
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Oct 9th, 2009
Re: Unique type
Reply #9 - Oct 14th, 2009 at 5:17pm
Print Post  
var Nodename=shapeId + numNodes;
here i am getting nodename ..iam saving it in to database .

Now iam retrieving the nodename by this code

string nodename= ds.Tables["data"].Rows[i]["nodename"].ToString();.


string nodetext= ds.Tables["data"].Rows[i]["nodetext"].ToString();.



So how can i bind the nodenames to shapes.
like
Start.Shape=Shapes.Decision
Start.Text="Start"

Here Decision i have to bind dynamically means I want like this

Start.Shape=Shapes.nodename
Start.text=nodetext

please send me any code if you have
thanks for your time
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unique type
Reply #10 - Oct 15th, 2009 at 9:20am
Print Post  
If you want to use this Nodename as an id, assign it to the Tag property and later use the FindNode method to get the DiagramNode. This example shows that, using your previous date/time based IDs:
https://mindfusion.eu/_samples/netdiag_SqlServerStore.zip
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint