Count only an atributte of an entity

Hello.

I´m creating a Traditonal Web App, to manage Activities and actions that are associated to those activities. I need to get the count of actions that are associated to an activity, but it´s showing this error...

Could really use some help to understand this error.

Thanks :)

Solution

Hi Camila Rodrigues,

The Query select statement should be as mentioned below (you missed the count function opening and closing parenthesis)

Code Snippet

SELECT {Acao}.[Id], count({Acao}.[Id]) -- you can also use count(*) 
FROM {Acao} 
INNER JOIN {Atividade} 
    ON {Acao}.[AtividadeId] = {Atividade}.[Id]


Observation: The INNER JOIN Condition and the mentioned WHERE Clause are exactly the same, so you can remove the WHERE clause section if this is the only filter condition you do have for the query block.


Note:  COUNT() is a function and also make sure that the selected column count (in the select statement) should match the Output structure column/attribute count.


Hope this helps you!


Regards,

Benjith Sam


Solution

Hello Camila.

I checked your query and there are a few things you should review.

First, like Benjith said, you don't need that WHERE condition. It is a duplication of the ON.

Then, you are not using the Input Parameter. Based on the name you gave, I think you tried to use it as an Output Parameter... The output is on Structure1 which must be similar to your Select (must have attributes of type AcaoId and Integer). You can delete that Input.


Thanks for  the reply :)