SyntaxError: missing ) after argument list


I am having an error with some of my program indicators. Please see the error below:

angular.min.js:102 Expression with id rule:UyIt4v8uxSx could not be run. Original condition was: d2:condition(‘d2:countIfValue(#{S8ZmR13sdcP.jRw8beZBmuA},“1”) + d2:countIfValue(#{S8ZmR13sdcP.tYSr4Ya4cWv},“1”) + d2:countIfValue(#{S8ZmR13sdcP.Y9mHMACp9V0},“1”) + d2:countIfValue(#{S8ZmR13sdcP.n3mieQQ2eW1},“1”) + d2:countIfValue(#{S8ZmR13sdcP.k95bJ0LBfHP},“1”) + d2:countIfValue(#{S8ZmR13sdcP.Nm98W1ZVnz9},“1”)+ d2:countIfValue(#{S8ZmR13sdcP.VAUw7DuXxra},“1”)>=2’, true, false)

  • Evaluation ended up as:d2:condition(‘d2:countIfValue(‘S8ZmR13sdcP.jRw8beZBmuA’,“1”) + d2:countIfValue(‘1’,“1”) + d2:countIfValue(‘1’,“1”) + d2:countIfValue(‘1’,“1”) + d2:countIfValue(‘1’,“1”) + d2:countIfValue(‘1’,“1”)+ d2:countIfValue(‘1’,“1”)>=2’, true, false)
  • error message:SyntaxError: missing ) after argument list

Your assistance will be greatly appreciated.

This error is actually the same error as this error from 2019. @Markus I see you commented on the previous error. Do you have any ideas for @MSP’s question on Feedback 1?

Thanks in advance.

The expression in and by itself should be working fine except the true-expr & the false-expr need to be numbers as it may seem … when using true/false it doesn’t work. Additionally, make sure you’ve access to all the data elements used because it seems that from your expression all were evaluated to 1 except for the first one. Do you have access to data element ‘#{S8ZmR13sdcP.jRw8beZBmuA}’?

Hope this helps as a start! Thanks! :+1:

Hey @Gassim!! Thanks for the assist!! Really appreciate it!

So about the data element, I’m also wondering what’s wrong with it. So I have a weird situation where the first data element always doesn’t get evaluated. Every time I remove the first data element, the next one that becomes number 1 doesn’t get evaluated.

So I just tested the 0,1 thing on my instance (2.35) and on play (2.37) and I get an error when I replace true/false with 0,1.

What version of DHIS2 are you on? Would you mind replicating on play so I see what’s different about your situation?

1 Like

Hi Clara,
I’m using and selected the child program. The data element I used is MCH Infant Weight (g) from the Program Stage Baby Postnatal.
Here’s the expression and it’s being validated as valid:

d2:condition('d2:countIfValue(#{ZzYYXq4fJie.GQY2lXrypjO},3)+d2:countIfValue(#{ZzYYXq4fJie.GQY2lXrypjO},3) > 3',0,1)

I guess this depends on the value type of the data element. When using d2:countIfValue(,value) the value should be the same data type as the DE.

I tried to use the expression you shared above (thanks to you for showing it on play) and it worked when I removed the string type from the value in d2:countIfValue:

d2:condition('d2:countIfValue(#{dBwrot7S420.sWoqcoByYmD},1)+d2:countIfValue(#{dBwrot7S420.sWoqcoByYmD},1) >= "2"', 0,1)

If it still doesn’t work please first try to clear the browser cache using the Browser Cache Cleaner app and the app cache using Data Administration app → Maintenance ‘Clear Application Cache’ & ‘Reload apps’ then try again. To be 100% sure you’re not facing a cache issue, try a clean profile in your browser or a different browser and better if in incognito/private mode.

Hope this helps! :+1:

1 Like

@Gassim you definitely helped!! Removing the quotes around the 1s got rid of the error! Thanks a ton!! Now I need to figure out why my first data element still won’t read. But thanks a lot for the assistance!

1 Like

Sure, pleasure! (:

Thanks, as you see this is not happening in play so it’s could be a cache issue?

Hey @Gassim. So I’m getting the same error on play.

This is my indicator.

1 Like

Hi the program indicator you created in play got deleted. It’d be better if you share the expression here. I did ask for support because I tested it and wasn’t able to figure it out; however, now I’m trying to get back to this and I got confused is this still the same issue as above?

Thanks! :+1: