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

  • SEARCH
  • Home
  • 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 9024453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:00:52+00:00 2026-06-16T06:00:52+00:00

Please read the following template: PID Status LPID 10 Closed 25 11 Open 25

  • 0

Please read the following template:

PID     Status      LPID

10       Closed      25
11       Open        25
31       Open        31
25       Closed      25
54       Open        31
17       Open        17
20       Closed      31
88       closed      77
77       closed      77
201      open       202
205      open        500

Now when PID!= LPID, that PID is defined as CPID(Child Process ID),Otherwise it is a PPID(Parent process ID)

Now I am looking for a code which will tell which is parent and Which is child- means marking them in another sheet.At the Same time i want to list down all CPID,with PPID in the same row,If any PPID has child Processes themselves. Output would be look like below

PID   Type Of Process?    Child List
10       Child
11       Child
31       Parent              54 20
25       Parent              10 11
54       Child
17       Parent
20       Child
88       Child
77       Parent              88

I have written a code using VBScript,but with the actual sheet it is too slow. For 2500 data it is taking close to 1 hour.So I Want a more faster process than my one.

Could you help here using VBscript?

Code1:

  Set objExcel1 = CreateObject("Excel.Application")'Object for W2W Report Dump


  strPathExcel1 = "D:\VA\CopyofGEWingtoWing_latest_dump_21112012.xls"
  objExcel1.Workbooks.open strPathExcel1

  Set objSheet1 = objExcel1.ActiveWorkbook.Worksheets(2)
  Set objSheet2 = objExcel1.ActiveWorkbook.Worksheets(1)

    IntRow1=1
 Do While objSheet1.Cells(IntRow1, 1).Value <> ""

    IntRow2=4
    IntChildListColumn=3

    If objSheet1.Cells(IntRow1,2).Value="Parent" Then

        Do While objSheet2.Cells(IntRow2, 1).Value <> ""

             If objSheet2.Cells(IntRow2,11).Value=objSheet1.Cells(IntRow1,1).Value And objSheet2.Cells(IntRow2,11).Value <> objSheet2.Cells(IntRow2,1).Value Then

                 objSheet1.Cells(IntRow1,IntChildListColumn).Value=objSheet2.Cells(IntRow2,1).Value
                 IntChildListColumn=IntChildListColumn+1

             End If

      IntRow2=IntRow2+1

      Loop

   End If

 IntRow1=IntRow1+1

Loop

Code2:

 Flag=0
 IntColTemp=1
 IntRowTemp=3

 Set objExcel1 = CreateObject("Excel.Application")'Object for Condition Dump


 strPathExcel1 = "D:\VA\CopyofGEWingtoWing_latest_dump_21112012.xls"
 objExcel1.Workbooks.open strPathExcel1

 Set objSheet1 = objExcel1.ActiveWorkbook.Worksheets(1)
 Set objSheet2 = objExcel1.ActiveWorkbook.Worksheets(2)

 IntRow1=4
 IntRow2=1

Do While objSheet1.Cells(IntRow1, 1).Value <> ""

  objSheet2.Cells(IntRow2, 1).Value = objSheet1.Cells(IntRow1, 1).Value


   IntColTemp=1
   Flag=0
  'This will travarse to the Parent Business Process ID column horizantally in the excel.
  Do While Flag=0

  If objSheet1.Cells(IntRowTemp,IntColTemp).Value="Parent Business Process ID" Then

      Flag=1       

  End If

      IntColTemp=IntColTemp+1


Loop
      IntColTemp=IntColTemp-1
      'MsgBox(IntColTemp)

  Strcmp1=trim(objSheet1.Cells(IntRow1, 1).Value)
  Strcmp2=trim(objSheet1.Cells(IntRow1,IntColTemp).Value)

  If Strcmp1=Strcmp2 Then

      objSheet2.Cells(IntRow2, 2).Value="Parent" 

  Else

      objSheet2.Cells(IntRow2, 2).Value="child"

  End If


   IntRow1=IntRow1+1
   IntRow2=IntRow2+1

  Loop

EDIT see the two ID 201 and 205 has the child-parent relationship.But the child id will then needs to present in the output column but parent 202 and 500 should not come to the output list, as there is no enetry in the main table 202 close/open 202 and 500 open/close 500

  • 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-06-16T06:00:54+00:00Added an answer on June 16, 2026 at 6:00 am

    Two ideas/strategies:

    1. Load the Range into an array instead of accessing the cells ((c) @DanielCook)
    2. Use a dictionary if you have to process data about (a set of) elements.

    In code:

    Option Explicit
    
    Class cP
      Public m_sRel
      Public m_dicC
      Private Sub Class_Initialize()
        m_sRel     = "Child"
        Set m_dicC = CreateObject("Scripting.Dictionary")
      End Sub
      Public Function show()
        show = m_sRel & " " & Join(m_dicC.Keys)
      End Function
    End Class
    
    Dim oFS   : Set oFS  = CreateObject("Scripting.FileSystemObject")
    Dim oXls  : Set oXls = CreateObject("Excel.Application")
    Dim oWb   : Set oWb  = oXls.Workbooks.Open(oFs.GetAbsolutePathName(".\00.xlsx"))
    Dim aData : aData    = oWb.Worksheets(1).Range("$A2:$C10")
    Dim dicP  : Set dicP = CreateObject("Scripting.Dictionary")
    
    Dim nRow
    For nRow = LBound(aData, 1) To UBound(aData, 1)
        Set dicP(aData(nRow, 1)) = New cP
    Next
    
    For nRow = LBound(aData, 1) To UBound(aData, 1)
        If aData(nRow, 1) = aData(nRow, 3) Then
           dicP(aData(nRow, 1)).m_sRel = "Parent"
        Else
           dicP(aData(nRow, 3)).m_dicC(aData(nRow, 1)) = 0
        End If
    Next
    
    Dim nP
    For Each nP In dicP.Keys()
        WScript.Echo nP, dicP(nP).show()
    Next
    
    oWb.Close
    oXls.Quit
    

    output:

    10 Child
    11 Child
    31 Parent 54 20
    25 Parent 10 11
    54 Child
    17 Parent
    20 Child
    88 Child
    77 Parent 88
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing image Read/Copy operations in WPF application. Please look at following piece
I'm beginner. I don't know why? I'm using Code::Blocks.Please read the following code: If
Please read Update1 first! This is SSIS specific question. I have the following tasks:
Please first read the following thread: Circular reference between Assemblies in C# and Visual
Assume the following code (Please read my question in the code comments in the
Please consider the following view: <p>Count <span data-bind=text: unreadCount()>&nbsp;</span></p> <div data-bind='template: { name: conversationTemplate,
I'm wondering if this code ... StringBuilder sb = new StringBuilder(Please read the following
Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to
Please read the following C++ code and the results. According to some wiki pages,
I have the following html structure. Please read abcd and efgh in the ids

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.