Highlighted
Absent Member.
Absent Member.
410 views

Populate parent associated with each child in datatable

My code goes like this, Right now the datatable is populating as parent in one column  and the child in another colum, but when i have more than one child, i need to have parent with each child.  how can i do this.

"Get the rowcount of datatable"
i = DataTable.GetSheet("PartnerSheet").GetRowCount
For j = 1 to itemsCount
 DataTable.GetSheet("PartnerSheet").SetCurrentRow(i + 1)
 sMainstring = defaultpage.WebList("ToList")).GetItem(j)
 sSubstring = Left(sMainstring, 2)  
 If sSubstring = "  " Then  
  DataTable.Value("Child", "PartnerSheet") = sMainstring 'sSubstring
  i = i + 1
 else  
  DataTable.Value("Parent","PartnerSheet") = sMainstring
 End if
Next

0 Likes
3 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: Populate parent associated with each child in datatable

What is the structure of the weblist, are both parent & child in one row of the weblist, something like:

"France, Paris"

"France, Nice"

"Germany, Bonn"

"Italy, Rome"

"Italy, Piza"

This kind of thing?

 

MArk Smith.

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Populate parent associated with each child in datatable

No its not in one row.  It is something like this

eg: France

       Paris

       Germany

  

 

 

 

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Populate parent associated with each child in datatable

Which part is the parent and which part the child?

In your code above you are checking the left 2 chars for spaces, I don't understand why you are doing this. CAn you paste the contents of the Weblist here so I can get a better idea?

Mark Smith.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.