Only print XULE message if case is true

30 views
Skip to first unread message

Angad

unread,
Mar 13, 2024, 11:57:40 AMMar 13
to Arelle-users
Hi,

I have the following XULE rule:

output ARF2-existence
$code1 = 'ARF2'
$a1 = list({covered @concept.local-name = $code1}).length
$a1 > 0
message {
if $a1 > 0
$code1 + " existence valid."
else
"Invalid! " + $code1 + " does not exist."}


I wanna make a change such that if the rule case is true, it prints the message and if its not it prints nothing. So only for the true case i get an output.

Could you please help me with this?

Regards,
Angad Khurana

David Tauriello

unread,
Mar 14, 2024, 6:23:11 AMMar 14
to Arelle-users
Hi Angad - it seems like this line in the expression means it will always evaluate as true:

$a1 > 0

What happens if you remove that line from the expression?

Sincerely,
David

David Tauriello

unread,
Mar 14, 2024, 6:38:21 AMMar 14
to Arelle-users
Angad - your code evaluates valid and invalid; paste the following into the second code (gray) cell here:  https://xbrl.us/xule-demo then run all cells.

The concept NonAssets does not exist.  If you want no message, just leave the else case as "" (quotes).

%%writefile 'sample.xule'
/** add constants and namespaces below **/
namespace us-gaap = https://fasb.org/us-gaap/2021
/** modify rule below **/
output ARF2-existence
$code1 = 'NonAssets'

$a1 = list({covered @concept.local-name = $code1}).length
$a1 > 0
message {
if $a1 > 0
$code1 + " existence valid."
else
"Invalid! " + $code1 + " does not exist."}

On Wednesday, March 13, 2024 at 11:57:40 AM UTC-4 angadkhu...@gmail.com wrote:

Angad

unread,
Mar 14, 2024, 9:30:30 AMMar 14
to Arelle-users
Hi,

What i wanted to ask was that yes i could put empty quotes in else and then it prints nothing but it dont want that empty line, i want the output on the powershell window to just have text corresponding to the rules where the case is true.

regards
Angad Khurana

David Tauriello

unread,
Mar 15, 2024, 10:51:59 AMMar 15
to Arelle-users
Angad - thanks for the clarification. In addition to empty quotes, remove covered from the XULE expression you've written.

Sincerely,
David

Reply all
Reply to author
Forward
0 new messages