data01
data02
data03... data76
etc
The reports are built by numerous scripts that dump all values into the fields, with the first row holding the headings.
I use placeholder text to display the reports, export with headings etc (all this works fine).
The issue I am having is sorting the onscreen display.
All fields are text, as it will vary what is in them. The layout only has 17 fields all being a "NOTHING" field to display the data as placeholders, and there are scroll buttons to view the next column along. Again, all this works great.
I have a sortValue field (again a text field) which is a calculation field, when a button is pressed to sort the "column" it loads the field name in as a variable $$SortKey
ReportMatrix::SortValue
Let([
full.field = "ReportMatrix::" & $$SortKey;
colon.position = Position ( full.field ; "::" ; 1 ; 1 ) ;
field.name = """ & Right ( full.field ; Length ( full.field ) - colon.position - 1 ) & """ ;
table.name = Left ( full.field ; colon.position - 1 ) ;
sql = "SELECT " & field.name & " FROM " & table.name & " WHERE ReportUUID=(?)";
execute = ExecuteSQL ( sql ; "" ; "" ;$$ReportID)
;
ThisRecord = Get(RecordNumber)+1
];
GetValue(execute;ThisRecord)
)
Again, the sorting works fine if it is text. However the column being sorted could contain text or numbers. The numbers can also contain negatives.
I cannot get the sort to work for either numbers or text, as each report could have the field populated by either.
(The reports are essentially cross tab reports with growth by products and other data).
I tried adding another field to sort as a number, but this doesn't sort text consistently.
ReportMatrix::SortKey
Let([
t = SortValue ;
a = Filter ( t ; KanjiNumeral ( t ) ) ;
n = Filter ( t ; ".1234567890" ) ;
pt = Right ( " " & a ; 20 ) ;
pn = Right ( "000000000000000000" & n & If ( not PatternCount ( n ; "." ) ; ".0") ; 20 )
];
Case(
Left ( t ; 1 ) = Left ( n ; 1 ) ; pn & " " & pt ;
pt & " " & pn
)
)
Any ideas on how to sort numbers and text as -9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,a,b,c,d...
Powered by WPeMatico
Neueste Kommentare