cancel
Showing results for 
Search instead for 
Did you mean: 

UI Script to Hide Columns Not Working

former_member183363
Active Contributor
0 Kudos
173

Hi all,

I've got a custom OWL, and I'd like to hide columns if there's no data in them. I found a thread on here with a script, which I've stuck in:

So as far as I can tell, if the value of said column (I've aligned the screens so you can see it in the data view) is nothing, the visibility is false; otherwise, it's set to true. But here's what I've got in ByDesign...

Clearly, Mon Drop is empty...but it's not hidden. Ideas?

Lewis

Accepted Solutions (1)

Accepted Solutions (1)

former_member183363
Active Contributor
0 Kudos

Never mind --- Pradeep solved it a different way in

former_member186648
Active Contributor
0 Kudos

use the following: result = true; for i in 0..($data.DataList.RowCount) rw = $data.DataList.Get(i).MondayVanRouteDrop; if ( rw == "" ) result = false; break; end end result = result; Thanks, Pradeep

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Lewis,

Try this:

if ($controller.resolve("/Root/DataList/MondayVanRouteDrop") == "")

result = false;

else

result = true;

end

result = result

Will

former_member183363
Active Contributor
0 Kudos

Hi Will,

Thanks for the quick reply. Same result I'm afraid, column's still there. Also tried it with a semicolon at the end of the last line. Does Ruby (I think this is Ruby) use a 'null' operator?

Lewis

Former Member
0 Kudos

Hi Lewis,

The documentation does mention that certain functions might return null, however there's no other mention of it. Have you tried using null?

An alternative approach would be to do a for loop through /Root/DataList/MondayVanRouteDrop and seeing if any of the fields have a length greater than 0.

Will

former_member186648
Active Contributor
0 Kudos

Hi, You could use the following:

result = true; for i in 0..($data.DataList.RowCount) rw = $data.DataList.Get(i).HdrNm; if ( rw == "" ) result = false; break; end end result = result;

Thanks, Pradeep

former_member183363
Active Contributor
0 Kudos

Adding null in there results in an error, it says it's an undeclared variable, so I'm guessing there's no null operator in Ruby. A cursory Google suggests the same. Hmm...

former_member183363
Active Contributor
0 Kudos

Pradeep,

That script results in a syntax error when I check it in the editor.