Adib Murtadha
 · Software Architect at Sahid Jaya Foundation

Count specified data using where on nested API

Hello everyone.

I am new with Xano and API.

My project is to make dashboard app using Draftbit.

So, what I do in Xano is to get and count data in the table.

I use query all records and addons to get another table data that related with id and I make it as "pd".

My goals is, I want to count how much data where .pd.idperiode == (e.g 20232).

And I want to show the name (.pd.namaperiodedaftar) of .pd.idperiode (e.g 20232 is "PROGRAM SARJANA (S1)")

What I imagined is, it'll be looks like:

{

pd: [

{

idperiode: (counted)

namaperiodedaftar: PROGRAM SARJANA (S1)

} ] }

I want to count that "idperiode" in "pd"

The first time I try, I just got 0 as the result.

After I try many things, I try to create a new variable and finally I can list the data of the "idperiode"

And I can count the "idperiode" too. but it's looks so plain, It's just show the result of the calculation.

I want the data looks something like this. Is it possible?

Actually, I need data of= idperiode(RAW),count(idperiode),namaperiodedaftar(that related/selected same as (count(idperiode)). e.g. 20232,81,PROGRAM SARJANA (S1)

And one more things. If I want to count another "idperiode", let's say the app that I'll create will show and count many "idperiode", how can I make it?

for example the response look's like this{ namaperiodedaftar : idperiodedaftar }:

PROGRAM SARJANA (S1)(namaperiodedaftar) : 81(count of idperiode)

PROGRAM MAGISTER (S2)(namaperiodedaftar) : 45(count of idperiode)

Did I need to make another API or there's another proper ways?

Please help me to resolve it.

Thanks a lot.

1
3 replies