Loop through dataset - check values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zamael

    #1

    Loop through dataset - check values

    Currently I have a dataset that populates as follows (example data):

    ID Cycle Drug_Day Name
    3 1 1 Initial
    3 1 15 Initial
    3 2 1 Initial
    3 2 15 Initial
    3 3 1 Initial
    3 3 15 Initial

    The problem comes in that currently all this data is being "dumped" to
    labels. The labels for the above data would look like this:

    C1; D1; Initial
    C1; D15; Initial
    C2; D1; Initial
    C2; D15; Inital
    C3; D1; Inital
    C3; D15; Inital

    They want it better formatted so they look better (understandable ).
    Well what they want two different checks of the data be ran. First
    check would see if all the Cycles had identical data (as-is the case
    above) and in that case the display then would be:

    Cx; D1, 15; Initial (the x meaning "all cycles" and the days grouped to
    minimize space)

    The second check they want ran is on the "name" column. With the data
    above; they all have the same values; but sometimes it will have
    different values. So if those are different; they want them broken out;
    but grouped together as much as possible. So in the above data example
    I'll change the data a little bit:

    ID Cycle Drug_Day Name
    3 1 1 Initial
    3 1 15 Initial
    3 2 1 Initial
    3 2 15 Sequential
    3 3 1 Initial
    3 3 15 Initial


    So now the readout on the labels should be:
    C1; D1, 15; Initial
    C2; D1; Initial
    C2; D15; Sequential
    C3; D1, 15; Initial

    So what I need is a check on all the rows of the dataset and then change
    the data in the dataset depending on what is the same. Does that make
    sense? The hard part is that the data are going to change heavily.
    Sometimes more than 3 cycles; sometimes more than 2 different drug days;
    sometimes the "name" field will change. so I'm having difficulty coming
    up with the logic to run through the rows and compare the different
    rows. Any help would be much welcomed.
Working...