Expression for QualifierResponseRatio in Report Builder

I've written the following Expression to flag qualifiers outside 20% in this report template in Report Builder:

I modeled it after Symmetry in the shipping System Suitability template.  It doesn't work and I get the following error:

Any suggestions?  

Parents
  • Tried this one too to incorporate some of the language similar to S/N in that same shipping template.   But I get the same error.  

  • Hello  ,

    The error 'Unexpected token ...' is a general Python syntax error. It usually means that there is an unpaired parenthesis, bracket, quote, etc. or that there is an incorrect indention or possible a missing ':' for an if, elif, or else statement. I'm not seeing anything obvious in your screenshots but depending on how the code was pasted in there could be hidden characters or extra spaces, tabs, or lines that are not obvious with just reading the code in the display.

    I would suggest a few things to help find the issue.

    First, if I'm doing major changes to a template, I find it more helpful to generate test reports from Quant rather than using the preview. This gives you more flexibility in testing, as you can easily limit the test to one sample or compound to test different conditions. You can have the report open in the editor and still specify it in a Quant reporting method. Just make certain you save the template before testing.

    Next, I would get into the habit of keeping backup copies or revisions of the template as you get certain sections working the way you like. This error could be due to some corruption of the template that may not be easily fixed. Having a previous working version can make it easier to back out recent changes to find exactly what caused a given error. 

    You can try to copy out the expression and then add it back one section at a time. In this case, I would start with just the final if statement and make certain that works by itself. Then you can start adding back the other conditional cell coloring statements and see if the problem can be isolated. It might also be resolved by careful copy and pasting from Notepad or some other plain text editor to make certain no invisible formatting characters are being included. 

    One final note on the code as you have posted it, once you resolve the unexpected token error make certain to check the outlier flag for Low or High and not the qualifier response itself. In this case you would check OutlierQualifierOutOfLimits. The data set manual can help with finding the correct outlier name.  

Reply
  • Hello  ,

    The error 'Unexpected token ...' is a general Python syntax error. It usually means that there is an unpaired parenthesis, bracket, quote, etc. or that there is an incorrect indention or possible a missing ':' for an if, elif, or else statement. I'm not seeing anything obvious in your screenshots but depending on how the code was pasted in there could be hidden characters or extra spaces, tabs, or lines that are not obvious with just reading the code in the display.

    I would suggest a few things to help find the issue.

    First, if I'm doing major changes to a template, I find it more helpful to generate test reports from Quant rather than using the preview. This gives you more flexibility in testing, as you can easily limit the test to one sample or compound to test different conditions. You can have the report open in the editor and still specify it in a Quant reporting method. Just make certain you save the template before testing.

    Next, I would get into the habit of keeping backup copies or revisions of the template as you get certain sections working the way you like. This error could be due to some corruption of the template that may not be easily fixed. Having a previous working version can make it easier to back out recent changes to find exactly what caused a given error. 

    You can try to copy out the expression and then add it back one section at a time. In this case, I would start with just the final if statement and make certain that works by itself. Then you can start adding back the other conditional cell coloring statements and see if the problem can be isolated. It might also be resolved by careful copy and pasting from Notepad or some other plain text editor to make certain no invisible formatting characters are being included. 

    One final note on the code as you have posted it, once you resolve the unexpected token error make certain to check the outlier flag for Low or High and not the qualifier response itself. In this case you would check OutlierQualifierOutOfLimits. The data set manual can help with finding the correct outlier name.  

Children
No Data
Was this helpful?