question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to Create Nodes with dynamic names and get output reference?

See original GitHub issue

Ok, I have a educational project where I need to create a bot using a nonSQL DB (firebase, mongodb etc). I’ll try my best to explain what I’m trying to do:

So, I have a chat bot, where it’s structure is object oriented, where the object names matters, and each object is composed by, A Text and it’s next steps. All object steps are structured the same way.

example of S Objects (S is just a prefix for the object name):

s0: {
      text: "Hello and welcome to botchat."
      nextStep: {
                      "1": { description: "show Website link", target: "s1"}
                      "2": { description: "end chat", target: ""}
                      }
}
s1: {
      text: "some website here."
      nextStep: {}
}

I have a backend to treat it, so don’t really mind so much how it works, So, what I am trying to do is create a Node where it acts like these S Objects. I tried some ways, but didn’t get it working as intended…

My questions are,

How to make an Node take an Output connection and read it’s destination, so it can make a reference to this destination node inside the nextStep object (inside target).

And is there a way to make nodes get a unique name? if there’s only one S Node, it’s name should be s0, and every new object inserted should be named with a new number, like s1, s2, s3, s4…

I didn’t figure out how to do it with rete, maybe I could invert output and input (I mean, their CSS’s, their positions) so I could take a reference of the last object, and pass the information I want, since output can’t have controllers. Well, I hope someone can help me with this, it’s been frustrating to make it work…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CosmicSnowcommented, Jul 12, 2020

@creadicted I am using Angular. I’ll probably just use css to control the input box and output socket positions, so they stay aligned. And about the input box, I’ll try to read info from the input and place it in a variable, and the socket outputs this variable, I don’t know how to do this part yet (not using rete) but I think it will work.

If I get it working, I can share it! No problems

1reaction
Ni55aNcommented, Jul 8, 2020

And is there a way to make nodes get a unique name?

Node name must be predefined (like function name in programming languages)

How to make an Node take an Output connection and read it’s destination

editor.toJSON() returns scheme where you can find output -> connections properties

so it can make a reference to this destination node inside the nextStep object (inside target).

This is done inside Rete.Engine when processing. I think you should convert your schema to compatible Rete.js scructure

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding a new node to a list and dynamically naming it
1 Answer 1 ... You would not "name" the new nodes, you just have "root" and "curr". To find any one node, start...
Read more >
How to use dynamic variable names in JavaScript
In JavaScript, dynamic variable names can be achieved by using 2 ... The eval() function executes this and creates the variable with the ......
Read more >
"Data to report" node generate report with dynamic names
Hi all, my workflow generates a pdf report using Data to Report node. when generating a report as pdf the report name by...
Read more >
Creating Data - APOC Extended Documentation - Neo4j
If the property names are dynamically specified we can use the apoc.create.setProperties and apoc.create.setRelProperties procedures.
Read more >
Adding dynamic output terminals to a .NETInput node - IBM
Procedure · Adding a dynamic terminal. Right-click the node and click Add Output Terminal. Enter a name for the new terminal and click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found