Note that there are some explanatory texts on larger screens.

plurals
  1. POParent and child process segregation and child listing
    text
    copied!<p>Please read the following template:</p> <pre><code>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 </code></pre> <p>Now when PID!= LPID, that PID is defined as CPID(Child Process ID),Otherwise it is a PPID(Parent process ID)</p> <p>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</p> <pre><code>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 </code></pre> <p>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.</p> <p>Could you help here using VBscript?</p> <p><em><strong>Code1:</em></strong></p> <pre><code> 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 &lt;&gt; "" IntRow2=4 IntChildListColumn=3 If objSheet1.Cells(IntRow1,2).Value="Parent" Then Do While objSheet2.Cells(IntRow2, 1).Value &lt;&gt; "" If objSheet2.Cells(IntRow2,11).Value=objSheet1.Cells(IntRow1,1).Value And objSheet2.Cells(IntRow2,11).Value &lt;&gt; 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 </code></pre> <p><em><strong>Code2:</em></strong></p> <pre><code> 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 &lt;&gt; "" 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 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload