Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007
    Posts
    18

    Unanswered: crosstabs and multile values in a field

    If you can help I would appreciate it,

    I have a field that contains multiple diagoses for each patient. I want to build a crosstab to give the totals for all patients for each diagnosis.

    The column/field contains 291.3&295.30&304.00&314.01.
    E.g. 291.30 is one diagnosis and 295.30 is a diagnosis.......

    How can I strip out the ampersand and advance an array to give me one value/total per diagnosis? I thought a crosstab would be great for this but since they work on column/field name and I only have one name for all diagnoses. I have placed around with the array function but don't have enough knowledge to get any usable results. I am stumped.
    Last edited by jerry.bates; 05-12-08 at 17:03.

  2. #2
    Join Date
    Sep 2003
    Posts
    156
    You have your diagnosis string... make a formula out of it

    Code:
    {@diagsnosis}="291.3&295.30&304.00&314.01.&314.08.&314.07.&314.06.&314.05."
    You can split it to get any element in an array

    Code:
    split({@diagnosis}, "&")[1]
    If you want to put it in a For loop... for i to the max number of elements in the array, use

    Code:
    ubound(split({@diagnosis}, "&"))
    so something like

    Code:
     local numbervar result := -1
    
    for i := ubound(split({@diagnosis}, "&")) do
    (
     (   split({@diagnosis},"&")[i]
        result := i;
    exit for)
    );
    result
    Or you can strip out each individual element..
    Code:
    //For 1
    if ubound(split({@diagnosis},"&")) >= 1 then
    split({@diagnosis},"&")[1]
    
    //for 2:
    if ubound(split({@diagnosis},"&")) >= 2 then
    split({@diagnosis},"&")[2]
    
    //for 2:
    if ubound(split({@diagnosis},"&")) >= 3 then
    split({@diagnosis},"&")[3]
    
    //etc.
    I hope this gives you an idea.
    rgs,

    Ghostman

  3. #3
    Join Date
    Sep 2007
    Posts
    18
    thanks Ghostman,
    I was able to write an SQL command to accomplish my immediate task, but I will definitely go and try this.
    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •