Skip to main content
Hi all

Would like to know if this is the right way of retrieving user work-list, and if yes what is it i am doing wrong because its not binding it to the gridview

Thank you in advance
Ntshengedzeni

Hi,


You did not include any code so I cannot say what could be the problem.


However, here is a sample which populates a Gridview on a page. It uses the SourceCode.Workflow.Client API:


 


 


 


 


 


 


 


 



Connection con = new Connection();
try
{
 con.Open("dlx:5252"); // Open connection to the server
 SourceCode.Workflow.Client.Worklist wlist = con.OpenWorklist(); // Open the worklist
 GridView1.DataSource = wlist; // Set the Gridview data source
 GridView1.DataBind(); // Databind the Gridview
}
catch (Exception ex)
{
 throw ex;
}
finally
{
 if (con != null) // Cleanup the connection
 {
  con.Close();
  con.Dispose();
 }
 con = null;
}


I hope this helps!


Regards,



Good Day

I am new to K2 aznd i am really learning a lot, i saw there are so many databases that K2 Blackpearl uses, and what database do i neet to connect to to cen ted this information, Data, ID, Activity Name and Folio

Thank you in advance
Ntshengedzeni

Hi,


It is not recommended to query the K2 databases directly.


However all the data you are looking for are exposed through the API. In the code above create a ForEach loop from the worklist which was returned and loop through each of the WorklistItems. Each WorklistItem object has all the necessary properties.


Hope this helps!


No, Maybe i am missing Something, if you go to K2Workspace you see the following under Worklist for the user, Folio, Process Name, ActivityName, Status. and the little Piece of code you sent before retrieves the following, AllocatedUser, SerialNumber, Data, ID and i would like to have a combination on my grid.

Please advice if i am missing something

Thank you in advance
Ntshengedzeni

Hi,


If you can get your hands on the Professional K2 blackpearl book, a code example is provided to achieve just this. Look on page 429 to find the example. I cannot copy the code here, but in short you will do the following to get the data:



  1. Create a DataTable object.
  2. Add all the columns you need to the DataTable.
  3. Create a foreach loop to loop through all the worklist items.
  4. For each worklist item returned create a new DataRow.
  5. Set the columns for each individual row.
  6. When all the columns for this worklist item is set, add the row to the data table.
  7. Outside of the foreach loop set the Gridview's data source to the data table.
  8. Databind the Gridview.

Using the above steps you will find that all the data is available.


I would strongly suggest that you get a copy of the Professional K2 blackpearl book, published by Wrox as this will help you a lot with queries like this. (ISBN: 978-0-470-29305-8)


Regards,


Good Day

Thank you very much, i managed to get it with your Suggestions.

Regards
Ntshengedzeni

Reply