Re: Order By in 4GL Report
Posted in 1997
Another one from the vaults: what you might get away with (depending on data types and sort sequences) is to try something like this: IF something THEN LET sql_stmt_l = "SELECT a, b, c, a FROM table ORDER BY a" ELSE LET sql_stmt_l = "SELECT a, b, c, b FROM table ORDER BY b" END IF FOREACH ex_sql INTO a,b,c,charvar OUTPUT TO REPORT x(a,b,c, charvar) END FOREACH REPORT x(a,b,c,charvar) ORDER BY charvar . . . END REPORT HTH. HTW! :-) On 7 Jan 97 at 18:26, Bryan Tonnet wrote: > Anyone know of a decent (decent = not recopying the entire report > block) way to include a dynamic "order by" in a 4GL report? > > That is, if my report driver is; > > LET sql_stmt_l = "SELECT a,b,c FROM z" > > IF something THEN > LET sql_stmt_l = sql_stmt_l clipped, " ORDER BY a" > ELSE > LET sql_stmt_l = sql_stmt_l clipped, " ORDER BY b" > END IF > > ; can the report be told of a variable "order by", or am I stuck > with a different report block for each possibility? -- Ciao, Billy I'd be in favour of apathy, but I just couldn't be bothered...