Page 1 of 1

how to display data of registered user?

Posted: Thu May 14, 2015 5:02 pm
by Nisa Khalid

hello,
i want to display data of registered user, for example parents can registered their kids not more than 3 ,they can register less than 3, i want to display the data of image ,name, and age . so if parents just registered two kids and it will display only two kids. it will display based on registered user

so in the mobile UI should i put 3 sets of label because maximum registered user are 3?


how to display data of registered user?

Posted: Fri May 15, 2015 1:25 am
by Yurii Orishchuk

Hi Nisa,

When user register children it will create new row in "children" collection with link to this user. So in "children" collection you should have "parent" field witch should be pointer to parents collection or just string with parent id.

Now you need to get count of "children" for certain user. For this goal you need:

  1. Create new list service to "children" collection.

  2. Add to this service "count" request parameter with value="1".
    Details: https://devcenter.appery.io/documenta...

  3. Query(using "where" request parameter) all items with parent_id = current user.

    Here an example of JS code if "parent_id" is a string field that stores parend "_id". This could should placed in service datasource "before send" mapping "where" request parameter.

    pre

    //Note you need replace this "534c7e16e4b02ae4f9496fc1" with ID you need.
    var objectId = "534c7e16e4b02ae4f9496fc1";

    //Here you should use field name instead of "parent_id"
    var whereObject = {"parent_id": objectId};

    return JSON.stringify(whereObject);

    /pre

    Regards.