Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Pattern - Gracefully exit pattern if Table has 0 results

hz2
Tera Expert

In a Discovery Pattern, how can I check if a Table has 0 results?

Steps:

1) Parse a file and store the results in a Table. Se

2) Use a Match operation to check if an array/table has 0 results. Stop execution of the pattern extension if there are no results. 

I tried this, but it does not work as expected. Only if the 

Operation: Match

$_rnr_scheduled_tasks_ is Empty

I've also tried:
$_rnr_scheduled_tasks_[] is Empty

and

$_rnr_scheduled_tasks_[*] is Empty

find_real_file.png

None of these conditions cause the Pattern to gracefully exit. Any idea on how to proceed?

1 ACCEPTED SOLUTION

Oh, alright, my bad, i sometimes am a bit slow.

I never had to do that before, but my guess is, that you could check for the first line in your table to be present. Could you check if

$_rnr_scheduled_tasks_[1]."some_column" is Empty

works? Ideally use a column that is always filled. The issue here is, that - as far as i understand patterns - the "isEmpty" only checks for the string based value of a variable. This means any table with columns - no matter if they have an value - is no longer empty (this at least is my interpretation of why it may not work in your case).

Also sorry for my daylong wait, i don't get notifications in time by the community at the moment...

Regards

Fabian

View solution in original post

6 REPLIES 6

Oh, alright, my bad, i sometimes am a bit slow.

I never had to do that before, but my guess is, that you could check for the first line in your table to be present. Could you check if

$_rnr_scheduled_tasks_[1]."some_column" is Empty

works? Ideally use a column that is always filled. The issue here is, that - as far as i understand patterns - the "isEmpty" only checks for the string based value of a variable. This means any table with columns - no matter if they have an value - is no longer empty (this at least is my interpretation of why it may not work in your case).

Also sorry for my daylong wait, i don't get notifications in time by the community at the moment...

Regards

Fabian

Thanks for that. Checking to see if a column is empty is a viable option for me, so that will work.

And I think you're spot on that "isEmpty" only checks for the string based value of a variable. 

I'll go with your suggestion and if I need to get more precise, I can do something with Eval().

Your help is greatly appreciated! Thanks