Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:29:04+00:00 2026-05-26T22:29:04+00:00

I’m trying to create a SQL statement which will recreate the hierarchical container/folder/test structure

  • 0

I’m trying to create a SQL statement which will recreate the hierarchical container/folder/test structure in SilkCentral Test Manager.

Silk Ordering - Screen Shot

  • Test containers have no ParentID
  • Test folders contain a ParentID and IsLeaf = 0
  • Tests contain a ParentID and IsLeaf = 1

This Query results in all of the test containers, folders, and tests:

SELECT "NodeID", "ParentID", "Name", "IsLeaf", "OrderNumber"
FROM "Silk"."TM_TestPlanNodes" AS TPN
WHERE PROJECTID = 36
ORDER BY "ParentID", "OrderNumber", "IsLeaf"

Here are some of the Results:

NodeID  ParentID    Name                        IsLeaf  OrderNumber 
65408               Installation and Upgrades   0       0   
65445               Connectivity                0       1   
65448               Focus                       0       2   
65409               GINA / PLAP                 0       3   
65446               Graphical User Interface    0       4   
71038               Login Properties            0       5   
65449               Miscellaneous               0       6   
70636               Net Firewall                0       7   
70998               Software Updates            0       8   
65447               Third-party Services        0       9   
70805               SilkTest Automated Tests    0       10  
68812   65408       0. Setup                    0       0
65454   65408       1. Installations & Upgrades 0       1   
65450   65408       Typical/Custom Installation 0       2   

I would like this ordering instead:
Silk Ordering

The ParentID is sorted, but if there exists a Node with the ParentID=thePreviousNode’sID, then that is chosen next. If there are multiple of those nodes, they should be ordered by IsLeaf and then, OrderNumber.

How to accomplish this? I’m very limited in what I can do, because I think very complicated syntax will end up throwing errors in Silk. I was going to try a nested SELECT statement:

SELECT "NodeID", "ParentID", "Name","IsLeaf" 
FROM "Silk"."TM_TestPlanNodes" 
WHERE PROJECTID = '36'AND ParentID LIKE (
  SELECT ParentID 
  FROM "Silk"."TM_TestPlanNodes" 
  WHERE NAME = 'Installation and Upgrades')

But this is getting this error: “Could not execute report query: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.”

This is why I’m fiddling with Order By.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:29:05+00:00Added an answer on May 26, 2026 at 10:29 pm

    You can use a recursive cte to create a hidden column and orderby that column. The hidden column should be Something like:

    WITH cte (NodeID, ParentID, Name, IsLeaf, [Order])
    AS
    (
        SELECT NodeID, ParentID, Name, IsLeaf, cast(NodeID as nvarchar(10))
        FROM "Silk"."TM_TestPlanNodes" 
        WHERE PROJECTID = '36'
        UNION ALL
        SELECT "NodeID", "ParentID", "Name","IsLeaf", cast(leftNode.ParentID as nvarchar(10)) + cast(leftNode.NodeID as nvarchar(10))
        FROM "Silk"."TM_TestPlanNodes" as leftNode
        INNER JOIN cte on cte.NodeID = leftNode.ParentID
        WHERE leftNode.ParentID = cte.NodeID
    )
    select  "NodeID", "ParentID", "Name","IsLeaf"  from cte
    order by cast([Order] as nvarchar(50))
    

    This was written in notepad so is possible to have some errors, but the idea is to make an [order] column that for example for 65530 would be 654086554569530 (the parent_parent, the parent and the node)

    EDIT:

    this only works if the ids are all 5 characters long, but from here you can make the proper tweaks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.