Hi,
I need a variable width of column set based on two conditions. If condition one is true and condition two is true, then set width to 82, if condition one is true and condition two is false, then set width to 90 etc. I tried with HasData function with nested IIf but it seems it doesnt work for all four cases. The first condition has to be a "HJ" expression in a POINT.HOLE_TYPE field and second condition is existance of any data in ODPOR.OP field.
<<HasData(<<ODPOR.OP>>,_
<<IIf(<<POINT.HOLE_TYPE>> = "HJ",82,105)>>,_
<<IIf(<<POINT.HOLE_TYPE>> = "HJ",90,113)>>)>>
Is there any proper way to do it
Thanks for help.
Hi Jakub,
HasData() won't work properly in that scenario.
Instead, you could use <<CBool(<<Count()>>)>> as the condition inside another IIf() function. So, your expression would be this:
<<IIf(_
<<CBool(<<Count(<<ODPOR.OP>>)>>)>>,_
<<IIf(<<POINT.HOLE_TYPE>> = "HJ",90,113)>>_
)>>
Count() counts the number of records in the ODPOR.OP field. Then CBool converts that value to a Boolean. In other words, if there is no data, the Count is 0, and the expression returns False. Otherwise, if there is data, the Count is > 0, and CBool will return True.
Often, it can be helpful to break these expressions down into smaller pieces and store them as User Report Variables. That can make it a little easier to write expressions for variable-width columns. Look at the "GENERAL BH / TP / WELL" log report in gINT std us lab.glb for a good example of what I am talking about (in that example, the Material Description column is variable width).
Jesse
Answer Verified By: Jakub Hruška