Reporting code problem

306
4
Jump to solution
02-21-2024 11:59 AM
Labels (1)
AudraPayne1
New Contributor

The highlighted portion is what we are trying to code so to further explain it, 

As far as the code block for the pavement areas on the extra advanced report goes, what is written out there is very much a work in progress and me trying out variations of an if statement on a summary section in the report.  I don’t actually know that an if statement there is even possible or if we have to go another route entirely though, which is why I felt this might need some ESRI support.

The jist was to write a pair of if statements for each issue group header, where the first one would try to determine if there is a greater than zero count of “pending” issues for that issue group.  If there is a greater than zero amount, it should display Unsatisfactory.  The second, nested if statement is supposed to do the exact opposite and is looking for the count of pending issues in the issue group to equal zero, in which case it would display satisfactory.

 if you could provide some help I can further explain if it doesn't enough sense.  

Thank you

@IsmaelChivite 

AudraPayne1_0-1708544418501.png

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Regular Contributor

So, your initial post has a bunch of IF statements that are attempting to test several parameters (i.e., reportdate_int, inspection_date_int, mxwostatus, and issuegroup). But, in your S123 layer above, it appears that your "Pavement Areas" group has already determined if the area is either "unsatisfactory" or "satisfactory". If this determination has already been made in the S123 app, what is the point of the IF statements in the Feature Report? You could just reference "Pavement Areas" alone.

------------------------

"Maybe it would be better to use the count_pvmnt from the layer BWI Part 139 Inspection but then how would I have it display satisfactory or unsatisfactory because that's what I would like it to show for this statement."

"...where the first one would try to determine if there is a greater than zero count of “pending” issues for that issue group. If there is a greater than zero amount, it should display Unsatisfactory."
${if BWI_Part_139.count_pvmnt>0}Unsatisfactory.${/}

"The second ... is supposed to do the exact opposite and is looking for the count of pending issues in the issue group to equal zero, in which case it would display satisfactory."
${if BWI_Part_139.count_pvmnt==0}Satisfactory.${/}

Then together:
${if BWI_Part_139.count_pvmnt>0}Unsatisfactory.${/}${if BWI_Part_139.count_pvmnt==0}Satisfactory.${/}

------------------------

"I want this to specify based on the date I am giving it which is "inspection_date_int" tell me if it is Unsatisfactory or Satisfactory for specifically "issuegroup" Pavement Areas between the "mxwostatus", 'COMP' and 'CLOSE'. (we just changed these values)"

Can you please provide the field names, types, and what the interaction looks like?

E.g., Only where issuegroup equals "Pavement Areas", reportdate_int is less than to equal to inspection_date_int, and mxwostatus is not equal to "Complete" or "Closed".

Here is a (maybe) fixed version for your initial IF statement. May help.

${if reportdate_int<=BWI_Part_139_Inspection.inspection_date_int && mxwostatus!="Complete" && mxwostatus!="Closed" && issuegroup=="Pavement Areas"}Unsatisfactory.${/}

View solution in original post

0 Kudos
4 Replies
abureaux
MVP Regular Contributor

Don't nest the IF statements. They should be separated. If the IF statement isn't satesfied, it just won't display anything.

E.g., ${if my_question<1}Words${/}${if my_question==1}More Words${/}${if my_question>1}Less words?${/}

0 Kudos
AudraPayne1
New Contributor

Hello, thank you for the response. So, I am trying to create a few statements here. Not the best at these. I want this to specify based on the date I am giving it which is "inspection_date_int" tell me if it is Unsatisfactory or Satisfactory for specifically "issuegroup" Pavement Areas between the "mxwostatus", 'COMP' and 'CLOSE'. (we just changed these values)

The issuegroup and mxwostatus comes from the issue layer (please see images below) 

Maybe it would be better to use the count_pvmnt from the layer BWI Part 139 Inspection but then how would I have it display satisfactory or unsatisfactory because that's what I would like it to show for this statement.

Can you help me? 

 

AudraPayne1_2-1708961833609.png

AudraPayne1_3-1708962022136.png

AudraPayne1_4-1708962151305.png

 

 

 

 

0 Kudos
abureaux
MVP Regular Contributor

So, your initial post has a bunch of IF statements that are attempting to test several parameters (i.e., reportdate_int, inspection_date_int, mxwostatus, and issuegroup). But, in your S123 layer above, it appears that your "Pavement Areas" group has already determined if the area is either "unsatisfactory" or "satisfactory". If this determination has already been made in the S123 app, what is the point of the IF statements in the Feature Report? You could just reference "Pavement Areas" alone.

------------------------

"Maybe it would be better to use the count_pvmnt from the layer BWI Part 139 Inspection but then how would I have it display satisfactory or unsatisfactory because that's what I would like it to show for this statement."

"...where the first one would try to determine if there is a greater than zero count of “pending” issues for that issue group. If there is a greater than zero amount, it should display Unsatisfactory."
${if BWI_Part_139.count_pvmnt>0}Unsatisfactory.${/}

"The second ... is supposed to do the exact opposite and is looking for the count of pending issues in the issue group to equal zero, in which case it would display satisfactory."
${if BWI_Part_139.count_pvmnt==0}Satisfactory.${/}

Then together:
${if BWI_Part_139.count_pvmnt>0}Unsatisfactory.${/}${if BWI_Part_139.count_pvmnt==0}Satisfactory.${/}

------------------------

"I want this to specify based on the date I am giving it which is "inspection_date_int" tell me if it is Unsatisfactory or Satisfactory for specifically "issuegroup" Pavement Areas between the "mxwostatus", 'COMP' and 'CLOSE'. (we just changed these values)"

Can you please provide the field names, types, and what the interaction looks like?

E.g., Only where issuegroup equals "Pavement Areas", reportdate_int is less than to equal to inspection_date_int, and mxwostatus is not equal to "Complete" or "Closed".

Here is a (maybe) fixed version for your initial IF statement. May help.

${if reportdate_int<=BWI_Part_139_Inspection.inspection_date_int && mxwostatus!="Complete" && mxwostatus!="Closed" && issuegroup=="Pavement Areas"}Unsatisfactory.${/}

0 Kudos
abureaux
MVP Regular Contributor

Also, regarding logic symbols, equals is ==, and not equals is !=

Have a look at this. Logical operators are at the bottom of the page (copy-pasted to below).

Operator Description

||

True if one of two statements returns true

&&

True if both given statements return true

!

True if the statement is not true

==

True if the two given values are equal to each other

!=

True if the two given values are not equal to each other

>

Evaluates whether the first value is greater than the second value

>=

Evaluates whether the first value is greater than or equal to the second value

<

Evaluates whether the first value is less than the second value

<=

Evaluates whether the first value is less than or equal to the second value

0 Kudos