Dynamic interface loading on tree node selection

Certified Senior Developer

Hello All,

I have a 2 column layout. in left section I have a tree with multiple node like shown in below.

  • Category1
    • Interface1
    • Interface2
  • Category2
    • Interface3
    • Interface4
    • Interface5

In right section I have to display the selected node's interface. For example if "Interface1" node is clicked then it should call an expression rule which returns the interface name to be loaded for that node. Now as expression rule returns string value, I am not able to render that interface in right section.

Please note  - Each node has associated interface and entire list is maintained in records. On tree node click that expression rule finds the interface name for selected node.

Kindly help if there is any other way to achieve this?

Thanks in Advance.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Not sure what your use case is here, but an expression can return a reference to an interface which you can then call from your other code.

    docs.appian.com/.../expression-advanced-evaluation.html

    And, without applying some known, but not recommended black magic, you cannot store such a reference in the database. Which, I think, is not an issue, because you have only a finite number of options. A simple expression that maps some string-identifier to the actual reference to the interface.

  • 0
    Certified Senior Developer

    Hi  
    So, you are storing categories and interfaces related to those categories in one record?
    And when one node is clicked you are calling an expression right, can you send the expression rule code for reference. Like on what basis that expression rule is fetching the interface name.
    If you need another approach
    If there are some static values for nodes, you can handle them using choose condition based on the node selected.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Thanks for your reply Stefan.

    Let me explain the usecase here -  We have a requirement of generating tree structure and selection of tree node, show the respective interface on the right side of the same interface. (Similar to our windows explorer)

    Our current Interface structure -> 2 Pane layout. In left side pane showing the tree structure and in right side pane want to show the respective interface of selected node.

    Data in DB - Below is the data available in DB. 

    Group Nodename InterfaceName
    G1 Node1 Interface1
    G1 Node2 Interface2
    G2 Node3 Interface3
    G2 Node4 Interface4

    and so on.

    Now as I mentioned above we are generating tree structure in the left side of pane using Group and Nodename columns. Now once the tree is generated and anyone clicks on the node, its respective interface need to be taken from DB and rendered in the right side pane.

    Now when we try to get the selected node's interface, it returns name of the interface (string data type). Which doesnt help. 

    I need rule!Interface1().  Not the string value.

    Please suggest how to achieve this functionality. I do not want to hard code anything in using condition, which can be one of way.  I just want to keep referencing to the DB data for interface name.

    Any optimal way to achieve this?

  • 0
    Certified Senior Developer
    in reply to Teja Kunchala

    Thanks Teja for your reply. Yes, I am storing categories and interfaces related to those categories in one record.

    Answer to second question - I already have all data available on that interface using records, so as of now no need of any expression rule to get the interface name. As soon as the node is clicked I am storing its interface name of that node, in one local variable. It gives me a string value and not sure how to convert that into an interface value.

  • 0
    Certified Lead Developer
    in reply to vijayan544557

    As I mentioned above, you cannot call an interface by its name. But, as all your interfaces need to be built, you can create an expression that maps a name (as string) to a reference to that interface.

    Edit: Yes, I know that using some plugins and other things, we can call a function just by its name, but that's not a design I would want to recommend!

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Hi Stefan, can you please elaborate in detail? I can check if we can take that route or not.

  • 0
    Certified Lead Developer
    in reply to vijayan544557

    Plugin: Content Tools

    Function: getrulereferencebyname

    Code could be: getrulereferencebyname("YOU_RULE_NAME")()

    But keep in mind, you will still have to develop each individual interface. Trying to call them by name, just for the sake of being able to, is a questionable design decision. At least in my opinion.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Thanks Stefan! this helps.