Query for Related table in Inbox Query

315
2
Jump to solution
07-23-2020 11:01 AM
BenBond
New Contributor II

I am working on a Survey123 app that utilizes the inbox for lechate monitoring at a landfill.  I would like to use the inbox to create a list of all the wells they have to measure for each day.

I currently have the query set to [Status='Active'] and that will pull in all the wells that need to be measured.  I then use a related table in a repeat for them to store the measurements.

The only problem is once they refresh the form all the wells will reappear.  So is there any way to add a related table query to the inbox query to only show wells that are [Status='Active'] and do not have a related table measurement taken today.

I hope that is as clear as mud...

Thank you

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello Ben Bond‌, 

One option would be to add a calculation question in your repeat and in either the Calculation or Default columns put a value of 1. 

Outside of the repeat you can create a hidden question and have a calculation that counts the number of those calculate questions. The calculation would look like count(${repeat_calculation}). 

You can then modify your where clause to be Status='Active' AND repeatcount>'1'. 

My sample XLSForm looked like: 

begin repeat 

text (for testing)

calculate                         Calculation: 1

end repeat

hidden                         Calculation: count(${calculate})

Thank you, 

Zach 

Thank you,
Zach

View solution in original post

0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello Ben Bond‌, 

One option would be to add a calculation question in your repeat and in either the Calculation or Default columns put a value of 1. 

Outside of the repeat you can create a hidden question and have a calculation that counts the number of those calculate questions. The calculation would look like count(${repeat_calculation}). 

You can then modify your where clause to be Status='Active' AND repeatcount>'1'. 

My sample XLSForm looked like: 

begin repeat 

text (for testing)

calculate                         Calculation: 1

end repeat

hidden                         Calculation: count(${calculate})

Thank you, 

Zach 

Thank you,
Zach
0 Kudos
BenBond
New Contributor II

Zach,

Ooo, I like that.  Initially as I was posting this question I though the easiest work around would be to create a new field on the base Lechate table and modify it with the last date pumped.  But I didn't really want to manage constant updates to the base table and have a field dedicated solely to the last time it was updated.

I really like the idea of performing the calculation in the repeat and filtering by a hidden field.  Sound great, I'll give it a try.

Thank you!

-Ben

0 Kudos