Selectively put Photos from Repeat in Report

2520
12
Jump to solution
06-19-2019 02:16 PM
deleted-user-cOp1WVV-PBwI
New Contributor II

Hello,

I'm looking to filter photos taken in the field and selectively put some of them into a report. Right now, photos are acquired in a repeat, and a select_one question also in the repeat has the user select from a few different types (overall, problem, and extra). See the photo below for a look at what's going on in excel. I've filled out a fake survey with three pictures that are "labeled" with the select_one question, one for each category in the same order as listed. In the report template at the moment, I'm trying to get just the photo that was labeled "overall" to show up. Code is as below:

${#photoRepeat}

${if ((photo_type) == “overall”)}

${photo|size:466.9:350}

${/}

${/photoRepeat}

No errors, but no matter what category the if statement is looking for it will print out all three photos. When it first printed all three, it was looking for the "overall" category, which was with the first picture. I tried changing the category to "extra" (the last picture) but still got all three photos, so it almost seems to me like the "${photo|size:466.9:350}" line is just spitting all three photos out. I'd love some thoughts on whether this endeavor is possible / where I'm going wrong if it is. 

Thanks!

Marlene McGraw

EDIT: I'm going to put the solution here just so it's all clear if anyone needs to reference this in the future; for checking these values, you actually need to see if it matches the label name, not the data field name. In this case, my data field name was "overall" vs my label "Overall", so the capitalized version worked. Jim Moore also made a great point that my syntax here is wrong too - you'd want it to look like so: ${if photo_type == "Overall"}.

0 Kudos
1 Solution

Accepted Solutions
Christopher_L_Rogers
New Contributor III

Hey Marlene,

One more idea that comes to mind is in your evaluation ${if photo_type == “overall”}...

Check your Choices List for your dropdown select_one pic_type you may be evaluating the Data Field versus the Label Name or missing the value based on case sensitivity... Make sure you are calling the right value and that the case matches what you have in the Choices List.

What are your choices in your Choice List for photo_type...????

Is it...

${if photo_type == “overall”}...

${if photo_type == “Overall”}...

${if photo_type == “OVERALL”}...

Other than that everything looks correct to me at first glance!

Regards,

Chris

View solution in original post

0 Kudos
12 Replies
Jim-Moore
Esri Regular Contributor

Hi Marlene

Thanks for the details. Removing the parentheses from your conditional statement should help, something like this:

${#photoRepeat}

${if photo_type=="overall"}

${photo | size:466.9:350}

${/}

${/photoRepeat}

Hope this helps, please let me know how it goes.

Kind regards,

Jim

deleted-user-cOp1WVV-PBwI
New Contributor II

Hey Jim! Thanks for getting back to me; I just tried your fix. A couple of interesting things have cropped up.

I recreated a fake survey - same keywords, pretty much identical to the old ones I made - but it appears, at the moment, that both my previous code and your suggestion aren't actually printing out any photos. I've confirmed that the photo_type values are present (they show up properly in this format: ${photo_type | selected:"overall"} Overall) and all of the photos and photo_types show up properly without the if statement, of course, but nothing shows up within the if statement at the moment. Since I put up the ask, I moved the photoRepeat further up in the survey but have otherwise not altered its name or content. Not sure what's causing the change...if you've got any thoughts, I'd appreciate them!

Thanks,

Marlene McGraw

0 Kudos
Christopher_L_Rogers
New Contributor III

Hello Marlene,

If your selector photo_type exists outside the Repeat that holds the photos this is part of your problem as you are trying to evaluate it from within the Repeat and it doesn't exist there. Now I'm making an assumption that this is the structure of your XLSM Form since it's not provided here but I have just solved this for myself on a project and it works perfectly.

So in short if your Dropdown for selecting photo_type=="overall" is in the repeat where the photos are capture then the following will work...

${#photoRepeat}

${if photo_type == “overall”} 

${photo | size:450:350} 

${/}

${/photoRepeat}

${photo | size:466.9:350} this is based on ${image1|size:width:height:max_width:max_height} not sure why you have a decimal in there 466.9 not recommended for sizing of photos.

In my Survey123 Application, I have a Page with a Repeat field in an App which allows our Troopers to selected and Add multiple Evidence Items with details and photos of the items. Inside the Repeat they select the Evidence Type and the fill-in the details and take a photo of the item. They can repeat this data collection routine over and over first starting each by selecting the Evidence Item Type' Drug, Weapon, Currency, etc.

After this is done all the Evidence entries end up in a related table including the photos. From here I can call the photos in my Word Template based on the evidType=="" as shown here...

I can also control the pagination and the ability to keep all of the information grouped together as I have a section for Subjects that is handled similarly that also has to determine if the Subject is the Person of Interest, a Passenger, a Witness, or Other...

Here's a snapshot of part of my Word Template that Sruvey123 uses to generate the Printable Output...

${#Item} ${if evidType == “WEAPON”}


EVIDENCE ITEM: ${evidType}

Weapon Type:

${weaponType}

Weapon Serial Number:

${weaponSerialNumber}

Blade Length in Inches:

${weaponBladeLength}

${evidPhotos | size:115:0}

Make:

${weaponMake}

Model:

${weaponModel}

Caliber:

${weaponCaliber}

Describe the Weapon:

${weaponOther}

Evidence Delivered By:

${evidStorageBy}

Evidence Initially Stored At:

${evidStorageLocation} ${sheriffOffice}

${/} ${/Item}

${#Item} ${if evidType == “CURRENCY”}


EVIDENCE ITEM: ${evidType}

Currency Type:

${currencyTypes}

Amount in US Dollars:

${currencyAmount}

${currenyBatchReport | size:115:0}

${evidPhotos | size:115:0}

Type of Currency:

${currencyType}

Counting Method:

${currencyCountMethod}

Evidence Delivered By:

${evidStorageBy}

Evidence Initially Stored At:

${evidStorageLocation} ${sheriffOffice}

${/} ${/Item}

Rinse and Repeat as necessary...

Here's what this part of my App looks like in Survey123... You'll notice that the Dropdown that determines the Type of Evidence Item is within the Repeat...

If you have any further questions on this please don't hesitate to reach out to me and I'll try and assist you as time permits. I'm also available for outside consulting if needed and I've provided both of my email contacts below.

Sincerely,

Chris Rogers

Christopher.rogers@dps.ok.gov

chris@qleapgis.com

0 Kudos
deleted-user-cOp1WVV-PBwI
New Contributor II

Hey Christopher! 

I appreciate you taking the time to give this a look. My photo_type is inside the repeat; you can see that in the image I attached to my original question, but I've also attached it here for convenience, alongside a screenshot of the report template and then the generated report (I switched the size just in case that had any effect, but it didn't appear to).

You mentioned that folks select the type first...I wonder if the type coming after the photos might affect the ability to filter? I may fiddle with the excel sheet and see if that has any effect.


Edit: Tried flipping the two of them, no effect on the photos.

Marlene McGraw

0 Kudos
Christopher_L_Rogers
New Contributor III

Hey Marlene,

One more idea that comes to mind is in your evaluation ${if photo_type == “overall”}...

Check your Choices List for your dropdown select_one pic_type you may be evaluating the Data Field versus the Label Name or missing the value based on case sensitivity... Make sure you are calling the right value and that the case matches what you have in the Choices List.

What are your choices in your Choice List for photo_type...????

Is it...

${if photo_type == “overall”}...

${if photo_type == “Overall”}...

${if photo_type == “OVERALL”}...

Other than that everything looks correct to me at first glance!

Regards,

Chris

0 Kudos
deleted-user-cOp1WVV-PBwI
New Contributor II

Good thought there; I have all the names in lowercase, so I don't think that's the problem. 

Marlene McGraw

0 Kudos
Christopher_L_Rogers
New Contributor III

LOL yes I see try changing you evaluation to this and see if you get a difference...

${if photo_type == “Overall”}

deleted-user-cOp1WVV-PBwI
New Contributor II

That worked! Odd, though, that it uses the label name and not the data field, I had anticipated it working the other way around. Good to know for the future, though!

Thank you so much for your help!

Marlene McGraw

Christopher_L_Rogers
New Contributor III

While I was testing this I found an anomaly in this trying to determine if the evaluated variable was using the name or the label of the Choices list in this isntance.

It appeared to me to be using the label in these instances but to ensure that I could reference it either way not knowing what the Survey123 expression might try to use for it's evaluation I changed all my Choices names and labels to Uppercase because I also use them dynamically to label the Table Name/Headers in my example previously provided.

I changed this and Viloa...!!!!