Forum Discussion

sohailalam2696's avatar
sohailalam2696
Occasional Contributor
6 months ago

Data loop testing

So, I have 100 customers and as you can see in the image above there are 6 files for Customer 1 but there may be 2 files for Customer 2. I did the data looping of Customer number only. How do I make the test that it after it completes with 6 files, it goes back and select Customer 2 and if Customer 2 has 3 files then complete that go to Customer 3 which has 5 files.

Thanks

2 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You will have to write a recursive function to to iterate through each tree nodes. For example in pseudocode,

    void TraverseTree(TreeNodeCollection nodes)
    {
        foreach (var child in nodes)
        {
            DoSomethingWithNode(child);
            TraverseTree(child.Nodes);
        }
    }

    I suggest you search for "iterate though tree control" on the Internet, and there will be plenty of examples. Hopefully, this should give you a good starting point.