From: <syl...@ya...> - 2003-09-10 12:31:25
|
it doesn't change anything :'((( my group #2 header (b) and my detail are always displayed... group #2 header(b) : '{DEVPAIE.RUBPREDA.OBSERV}'.empty? || '{DEVPAIE.RUBPREDA.OBSERV}'.nil? || '{DEVPAIE.RUBPREDA.OBSERV}'.trim==''? Detail : return (('{DEVPAIE.RUBPREDA.DATDEB}'.empty? || '{DEVPAIE.RUBPREDA.DATDEB}'.nil?) && ('{DEVPAIE.RUBPREDA.DATFIN}'.empty? || '{DEVPAIE.RUBPREDA.DATFIN}'.nil?) && ({DEVPAIE.RUBPREDA.NBJRS}.empty? || {DEVPAIE.RUBPREDA.NBJRS}.nil?) && ({DEVPAIE.RUBPREDA.NBHEUR}.empty? || {DEVPAIE.RUBPREDA.NBHEUR}.nil?) )? A little bug, in the Suppress dialog, there is a "Always Hide" checkbox. But it only appear when I resize the dialog window. Else it doesn't appear. If I check "Always Hide", these sections are always hide, so I suppose the hide system works, so my ruby code can be buggy... but I don't see why Sylvain --- Jim Menard <ji...@io...> a écrit : > Sylvain, > > >> See "Section Suppression Procs" at > >> <http://datavision.sourceforge.net/DataVision/ > >> anatomy.html#suppressionprocs>. Yours will look something like > >> > >> return '{table.comment}'.empty? > >> > >> This code will return true when the comment field is the empty > string, > >> and will therefore hide the section. > >> > > Looks very great but doesn't work :-( > > I tried different syntaxes and it doesn't hide the sections. > > I tried these one : > > > > if '{DEVPAIE.RUBPREDA.OBSERV}'.empty? > > return true > > In this code, Ruby requires an "end" after the return to match the > "if". Besides, you still need to return something if empty? returns > false: > > if '{DEVPAIE.RUBPREDA.OBSERVE}'.empty? > return true > else > return false > end > > though that is EXACTLY the same as > > return '{DEVPAIE.RUBPREDA.OBSERVE}'.empty? > > Note: if DEVPAIE.RUBPREDA.OBSERVE can be NULL, then you would have to > change that to > > return '{DEVPAIE.RUBPREDA.OBSERVE}'.nil? || > '{DEVPAIE.RUBPREDA.OBSERVE}'.emtpy? > > > return '{DEVPAIE.RUBPREDA.OBSERV}'.empty? > > ==> this one give me org.jruby.exceptions.ReturnJump error > > Throughout these examples, I assumed that DEVPAIE.RUBPREDA.OBSERVE is a > text column. If not, you may have to convert its value to text using > Ruby's "to_s" method, like this: > > return {DEVPAIE.RUBPREDA.OBSERVE}.to_s.empty? > > > '{DEVPAIE.RUBPREDA.OBSERV}'.empty? > > That does the same as "return ..." because if there is no return then > the value returned is the value of the the last statement in the script. > > > ('{DEVPAIE.RUBPREDA.OBSERV}'.empty || > {DEVPAIE.RUBPREDA.OBSERV}=='')? > > You need "empty?", not "empty". > > > > > ('{DEVPAIE.RUBPREDA.OBSERV}'.empty || > > '{DEVPAIE.RUBPREDA.OBSERV}'.trim > > =='')? > > > > and a blank line (because the field OBSERV is empty) is still there > :'( > > > > And for my details, the expression is a bit complex :-P > > return ('{DEVPAIE.RUBPREDA.DATDEB}'.empty && > > '{DEVPAIE.RUBPREDA.DATFIN}'.empty && > > ('{DEVPAIE.RUBPREDA.NBJRS}'.empty || > > '{DEVPAIE.RUBPREDA.NBJRS}'=='0.00') > > && > > ('{DEVPAIE.RUBPREDA.NBHEUR}'.empty || > > '{DEVPAIE.RUBPREDA.NBHEUR}'=='0.00') > > )? > > > > doesn't work too... > > When data are empty/null, DATDEB and DATFIN display nothing, NBJRS and > > NBHEUR display " 0.00 " (these are numeric fields in database). > > I tried with > > - {...NBJRS}==0 > > - '{...NBJRS}' == 0 > > - {...NBJRS} == '0.00' > > ... > > and doesn't work > > > > I don't see what is wrong. Can you help me? > > With numbers, don't use the quotation marks in the Ruby code. The > sub-expressions you want need to look something like > > {DEVPAIE.RUBPREDA.NBHEUR}.nil? || {DEVPAIE.RUBPREDA.NBHEUR}.empty? > > Jim ===== ________________________________________________________________________ http://iubito.free.fr - programmation - musique - Roumanie - annuaire... ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com |