Multiple columns for same intersection in a Matrix

DaveusDaveus Member Posts: 8
Hi All,

I'd like to have a matrix where there would be 2 columns for the same intersection

For instance, my columns are countries, and my rows are items, and for each intersection of an item-country, I need to display 2 different infos in 2 différent columns, such as a custom number and a custom description ( ...custom in the sens of crossing foreign borders, not customazible stuff! ). It's imperative that both infos are in separate columns since it has to be exportable in MS Excel, and it has to be in 2 different columns in Excel.

Anyone has a solution?

Thanx

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    Pretty simple actually. You can even make code to have a variable number of columns, but 2 is easy.

    Use integer as source for the Columns. Set the range filter to '1..' or '>0'

    Create a new function in the Form like this:
    DisplayValue(ColumnNo) Text;
    ActualColumnNo := columnno div 2;
    Country.reset;
    Country.findset;
    country.next(actualcolumnno); // this is slow, so only if there are a small number of records.
    Case columnno mod 2 of
      0 :
        BEGIN // first column
          ColumnType := 1;
          // put code in here to work out what needs to display in the first column
          exit(country.name);
        END;
      0 :
        BEGIN // first column
          ColumnType := 2;
          // put code in here to work out what needs to display in the first column
          exit(country.SpecialDescription);
        END;
    end;
    
    Then as source expression in the Matrix box call this function with the appropriate parameters.
    David Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    By the way, you can also use the same function by adding another passing parameter to set up things like BOLD or COLOR, so I would normally have one heading in bold and the other normal, or maybe use gray for one column.

    The only really issue with this solution is that you can't have different widths for each column.

    Oh and it can also be WRITEable, I have used this where the user can modify the data. That needs some more code of course. But this should get you started.
    David Singleton
  • stjernestjerne Member Posts: 7
    Interesting idea.
    Is your case sentence correct? It seems somewhat identical....
    Thank you.
Sign In or Register to comment.