Here I create a dynamic action that executes After Refresh of the relevant region.
Dynamic Action definition |
The client-side condition evaluates the presence of the
.nodatafound
class within a classic report, which is present only when no records are returned.Inspect element of region with no records |
The dynamic action then shows/hides the region, depending on the result of the JavaScript expression:
$(this.triggeringElement).find('.nodatafound').length == 1
The triggering element is the region, so find the class within that region, count the result set, and compare to value 1.
Instead of the region itself, this could relate to other components only relevant when records are returned.
As Maxime pointed out in the comments, here I was focussing on classic report regions. The relevant classes you may be looking for include:
- Classic Report (versatile):
nodatafound
- Interactive Report (IR):
a-IRR-noDataMsg
- Interactive Grid (IG):
a-GV-noDataMsg
This can mean there is no need for a server-side condition to test for existence.
With this dynamic action, the region could re-appear upon refresh with results, making the page more interactive without requiring full page submission.
Hello Scott
ReplyDeleteMight also want to consider the classes for the IR and the IG.
IR: a-IRR-noDataMsg
IG: a-GV-noDataMsg
Regards
Max
Hello Scott
ReplyDeletePlease share us details for, how to hide the charts when no data found
I thought I had seen this somewhere, but couldn't find an example.
ReplyDeleteTurns out this expression works, but relies on the text inside the no data found attribute, in my case 'no records'. This attribute doesn't accept HTML, replace shortcuts, or listen to the &P1_ITEM!RAW. substitution.
$('text:contains(records)').length == 1