Mobile not passing the correct id

Hello.

I´m developing a Mobile App that stores the data of activities, actions and subactions.

Each Activity can multiple actions, and the actions can also have multiple subactions(that have costs associated to them).

To show the sum of all costs of the action, I used the Sum function from the agreggate.

The problem is that that, in the actions list, it only assumes the id of the first action, and so it does´t show an accurate sum of the costs envolved on the subactions inside that action.


Could really get some help

Thanks :)

Hi Camila,

So I was checking your code.

The datamodel seems to be pretty straight-forward: one activity can have multiple actions and one action can have multiple subactions (costs are associated to the subactions).

As far as I understood from what you said, you want to show the sum of the costs for a specific action (meaning you want to calculate the sum from all the subactions costs for that particular action).


Since you have the Action Id as an input parameter of your screen, I'm assuming that you want to show the sum of the costs for that Action Id.

If so, in your aggregate, you don't even need to use the Activity entity :)


You just need to have 2 sources in your aggregate: Action and Subaction. And then you should use the Sum option over the Custo_Total attribute:


In the filters section, you should filter by the Action Id that is an input parameter of your screen:

Acao.Id = AcaoId


This should return the sum of all the costs for that specific Action.

Hope that this helps.


Kind regards,

Rui Barradas

Rui Barradas wrote:

Hi Camila,

So I was checking your code.

The datamodel seems to be pretty straight-forward: one activity can have multiple actions and one action can have multiple subactions (costs are associated to the subactions).

As far as I understood from what you said, you want to show the sum of the costs for a specific action (meaning you want to calculate the sum from all the subactions costs for that particular action).


Since you have the Action Id as an input parameter of your screen, I'm assuming that you want to show the sum of the costs for that Action Id.

If so, in your aggregate, you don't even need to use the Activity entity :)


You just need to have 2 sources in your aggregate: Action and Subaction. And then you should use the Sum option over the Custo_Total attribute:


In the filters section, you should filter by the Action Id that is an input parameter of your screen:

Acao.Id = AcaoId


This should return the sum of all the costs for that specific Action.

Hope that this helps.


Kind regards,

Rui Barradas

Hi,

I think he use one record from other data source to pass in as input parameter. There should be 3 cases can occur:

  1. The input data source is not loaded yet
  2. There are more than 1 record in in the input data source, which Current property can return wrong one
  3. Use wrong attribute from the input data source to filter

Hope this help

 

Hello. Thanks for all the answers :)

I believe I can´t use the AcaoId parameter because there are multiple records to be shown...

In this case, for example, I think I need to get the current id of the list that contains the actions...

Maybe I´m wrong... 


*The reason why I was using the GetAcaosByAtividadeId is because that is the record of actions on the list. So I thod maybe that´s the way to get the current Id.. Perhaps thats a best way to do it....


Thanks :)

Camila Rodrigues


Hello again Camila,

Do you need to show the individual sum for each action related to an activity and display those results (records) in a list? Or do you need to show the total sum of the actions that are associated to an activity?


Kind regards,

Rui Barradas