locked
fetching description, from from CCD RRS feed

  • Question

  • How can I retrieve the description or from values from a CCD item?

    List<HealthRecordItem> get_list_1_CCDs = GetValues<HealthRecordItem>(CCD_THING_GUID);
     foreach (HealthRecordItem item in get_list_1_CCDs)
     {
        if (item != null)
        {
          lblCCDdescription.Text = item.description;
          lblCCDfrom.Text = item.from;
        }
     }
    Monday, November 2, 2009 10:32 PM

Answers

  • Hello Gary,

    You can get the Description and From values for a CCD item using HealthRecordItemDataTable.
    Below is the code sample that will be useful for you.

    Code Block
    =======

            List<HealthRecordItem> ccdItems = GetValues<HealthRecordItem>(CCD_THING_GUID);

            HealthRecordAccessor accessor=new HealthRecordAccessor(ApplicationConnection,CCD_THING_GUID);       
            HealthRecordFilter filter = new HealthRecordFilter(CCD_THING_GUID);
            HealthRecordItemDataTableView view = new HealthRecordItemDataTableView();        
           
            HealthRecordItemDataTable datatable = new HealthRecordItemDataTable(view, filter);
            datatable.GetData(accessor, ccdItems, 1, ccdItems.Count);

            DataRow row = datatable.Rows[0];
            string description = row["Description"].ToString();
            string from = row["From"].ToString();

    Hope this helps..


    -Mahesh
    Tuesday, November 3, 2009 5:30 PM
  • If you want to work with Grid, you can go through Eric blog post to get more details on HealthRecordItemDataGrid.

    From the code, I could observe that the datatable Rows is "0", as you will get only the first row everytime you loop in.
     DataRow row = datatable.Rows[0];

    Please use the code below:

     datatable.GetData(accessor, ccdItems, 0, ccdItems.Count);
           
            for(int cnt=0;cnt<datatable.Rows.Count;cnt++)
            {
            DataRow row = datatable.Rows[cnt];
            string description = row["Description"].ToString();
            string from = row["From"].ToString();
            }

    Hope this helps...


    -Mahesh
    Wednesday, November 4, 2009 4:38 PM

All replies

  • Hello Gary,

    You can get the Description and From values for a CCD item using HealthRecordItemDataTable.
    Below is the code sample that will be useful for you.

    Code Block
    =======

            List<HealthRecordItem> ccdItems = GetValues<HealthRecordItem>(CCD_THING_GUID);

            HealthRecordAccessor accessor=new HealthRecordAccessor(ApplicationConnection,CCD_THING_GUID);       
            HealthRecordFilter filter = new HealthRecordFilter(CCD_THING_GUID);
            HealthRecordItemDataTableView view = new HealthRecordItemDataTableView();        
           
            HealthRecordItemDataTable datatable = new HealthRecordItemDataTable(view, filter);
            datatable.GetData(accessor, ccdItems, 1, ccdItems.Count);

            DataRow row = datatable.Rows[0];
            string description = row["Description"].ToString();
            string from = row["From"].ToString();

    Hope this helps..


    -Mahesh
    Tuesday, November 3, 2009 5:30 PM
  • HealthRecordItemDataTable?

    Excellent!

    Thanks Mahesh.
    Tuesday, November 3, 2009 5:57 PM
  • I know this is basic, but what are my options for displaying the data on the .aspx side?

    Most of the references I have show this when working with a database as a data source.

    I can't figure out, for example, what the data source is for a GridView.

    Can you point me to some references.

    I would prefer to use a view where I have more control over the layout.

    However, if you think a GridView is the most practical then please let me know how I can bind this data to the view.

    Thanks,
    Gary
    Wednesday, November 4, 2009 2:31 AM
  • I partially solved my problem.

    The highlighted code below loops through the correct amount of CCD items in the record.

    However, it repeats the first values in the data table.

    How can I fix this so that it loops properly through all the rows in the data table?

              c_CCDTable.Rows.Clear();
              TableRow headerRow = new TableRow();
              TableHeaderCell headerDateCell = new TableHeaderCell();
              headerDateCell.Text = "Description";
              headerRow.Cells.Add(headerDateCell);

              TableHeaderCell headerHeightCell = new TableHeaderCell();
              headerHeightCell.Text = "From";
              headerRow.Cells.Add(headerHeightCell);

              c_CCDTable.Rows.Add(headerRow);

              List<HealthRecordItem> ccdItems = GetValues<HealthRecordItem>(CCD_THING_GUID);
              HealthRecordAccessor accessor = new HealthRecordAccessor(ApplicationConnection, CCD_THING_GUID);
              HealthRecordFilter filter = new HealthRecordFilter(CCD_THING_GUID);
              HealthRecordItemDataTableView view = new HealthRecordItemDataTableView();
              HealthRecordItemDataTable datatable = new HealthRecordItemDataTable(view, filter);
              datatable.GetData(accessor, ccdItems, 1, ccdItems.Count);
              DataRow row = datatable.Rows[0];
              string description = row["Description"].ToString();
              string from = row["From"].ToString();
              foreach (DataRow r in datatable.Rows)
              {
                  TableRow ccd_row = new TableRow();
                  c_CCDTable.Rows.Add(ccd_row);

                  TableCell descriptionCell = new TableCell();
                  descriptionCell.Text = description;
                  ccd_row.Cells.Add(descriptionCell);

                  TableCell fromCell = new TableCell();
                  fromCell.Text = from;
                  ccd_row.Cells.Add(fromCell);
                  // lblCCD_Description.Text = description;
              }
    Wednesday, November 4, 2009 4:30 AM
  • If you want to work with Grid, you can go through Eric blog post to get more details on HealthRecordItemDataGrid.

    From the code, I could observe that the datatable Rows is "0", as you will get only the first row everytime you loop in.
     DataRow row = datatable.Rows[0];

    Please use the code below:

     datatable.GetData(accessor, ccdItems, 0, ccdItems.Count);
           
            for(int cnt=0;cnt<datatable.Rows.Count;cnt++)
            {
            DataRow row = datatable.Rows[cnt];
            string description = row["Description"].ToString();
            string from = row["From"].ToString();
            }

    Hope this helps...


    -Mahesh
    Wednesday, November 4, 2009 4:38 PM
  • I appreciate the fantastic support, Mahesh.

    I knew it was a basic loop, but I'm new to C#.

    Thanks again.
    Wednesday, November 4, 2009 4:40 PM