What should be passed in Aggregation Input Field to show all data.
Application Type
Reactive

Hello All,

What should be passed in Aggregate Input Field to show all data. 

I have one aggregate in which i have pass input field, In screen i have one button(ShowALL)  
What i need is that, when i click on the show all button i need to fetch all the records from the    Aggregate.  
What should i pass??

i have pass -1, 0 and  NullIdentifier()   not working..

Example in below Snap

Can anyone help me on that.

mvp_badge
MVP
Solution

Right, try this way:

Leaves.userId = GetUserId()
and
(
  showAll = 0
  or
  (showAll <> 0
    and
    Leaves.StatusId = IntegerToIdentifier(showAll))
)

Regards.

mvp_badge
MVP

Hi JK2020,

You can do it this way:

Leaves.userId = GetUserId()

and

(

  showAll = nullidentifier() /*or = 0 if your variable is integer*/

  or

  showAll <> nullidentifier() /*or <> 0 if your variable is integer*/

  and

  Leaves.StatusId = showAll

)

Attention to your LEaves.StausId field, must be of the same type as the showAll variable.

I am also considering that your StatusId are > 0 if integer.

Hope it's help.

Regards.

Hello Agno,

Thanks for you quick response.  But still not working as can see in the below snap.

i have passed 0 and also NullIdentifier() after applying the mention code..

yes i have StatusID >0 and showall variable as integer.



Can you suggest me any other solution.


Thanks,

JK

mvp_badge
MVP
Solution

Right, try this way:

Leaves.userId = GetUserId()
and
(
  showAll = 0
  or
  (showAll <> 0
    and
    Leaves.StatusId = IntegerToIdentifier(showAll))
)

Regards.

Hello Agno,

Really thanks :)

The mention code worked.


Thanks for your time and reply.

mvp_badge
MVP

Hi JK2020,

Before suggesting you a solution to your problem, I would suggest you to go through the online training materials provided by OutSystems for Reactive Web Applications. 

One of the possible approaches to solve your problem is given below:

Step 1: Declare a local variable of Integer data type at the screen level, say , varMaxRecords, with a small default value, say 5.

Step 2: Fetch data from from the data using an aggregate at the screen level.

Step 3: Click on the aggregate and you will find a property called Max Records. Assign that property with the variable created in step one.

Step 4: On the interface create a button, say Show All and bind it to a new screen action.

Step 5: Now in the newly created screen action in the previous step, assign the local variable, created in Step 1 with a bigger value, say 1000.

Step 6: After the assignment, in the previous step, drag and drop the Refresh Data tool in the screen action and set the data source of it to that of the aggregate created in Step 2.

Step 7: Publish the changes made.


In all the above steps I am assuming that you are aware how to show the the data fetched from the aggregate on the screen using List Widget. If you are not, you need to seriously go through the training materials.

Now the approach I mentioned above doesn't actually fetch all the data from the specific table on which your aggregate is based on. You are just increasing the max record fetched to 100. So if there are more than 100 records, in the database, this will only return first 100 records. Now to know the actual number of records, what you can do is bind the aggregate to another screen action using the OnAfterFetch property. In that screen action you can call a server action, inside which use an advanced SQL Query and do a simple SELECT query on the same table. Return the value in the length property of the list returned by the Advanced SQL Query. This will be the actual count of the number of records in the table. Store it in a different local variable and assign this stored value to varMaxRecords local variable on button click screen action.

Hope this helps.

Cheers!

Shounak

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.