Instead of only showing the ID, can we display a specific field from the "ethn" table?

Options
Hanan Radwan
Hanan Radwan Member
edited August 2023 in WeWeb

I am developing a school application that involves linking Xano and Weweb. I am facing an issue where I need to link multiple tables together, but the field name is not appearing in Weweb, instead, only the identifier is visible. For instance, when I link the student and school class tables together, the class ID is displayed instead of the class name for each student. I am looking for a solution to display the field name instead of the identifier. This issue is occurring in several points of the application.

Tagged:

Best Answers

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Answer ✓
    Options

    Hi @Hanan Radwan - you can use an Addon to decorate the table reference with the related data

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Answer ✓
    Options

    So you're wondering:

    Parent

    - id

    -student_id[]

    User/Student

    -id

    VS.

    Parent

    - id

    User/Student

    -id

    -parent_id

    Both are acceptable schemas. To me (and I don't know the full context of your app), the latter option having a relationship with the user is easier to work with. I tend to prefer working without nested lists or objects when possible but that's more of a preference thing.

Answers

  • Hanan Radwan
    Options

    Thank you, it works. I was using functions without any success 🤷‍♀️

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Awesome, glad that worked!

  • Hanan Radwan
    Options

    Hello @Michael Udinski,

    Thank you for your assistance.

    The images provided illustrate the user table, which includes roles such as administrator, teacher, student, and parent. To accommodate the distinct data associated with each role, separate tables have been created.

    The students have been successfully added to their respective table. Additionally, families have their own table .

    Currently, the objective is to add the names of each parent's children to their designated field. Object binding has been utilized to achieve this.

    While reviewing the data, it is possible to obtain parent information from the user table. However, retrieving student data has proven challenging due to the student's association with the student table through their user ID, which has undergone changes.

    I hope the explanation provided is clear.

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Hi @Hanan Radwan - Let me see if I'm following, you want to Addon the children's info to student ID? You would use an Addon, single return for this implementation.

    Also, I suggest you use a table reference list instead of an object list for your list of relationships (unless you are storing additional data within each list)

  • Hanan Radwan
    Hanan Radwan Member
    edited September 2023
    Options

    Perhaps a parent has multiple children. How can I check this within the table reference list? Duplicate parent record for each child?

    In my application, on the Parent page, I require displaying all the children along with their details who come under a parent.

    P.S :For every table that I have, there are several distinct details.

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Yes - this is still accomplished with an Addon. You will do an Addon to the list, since you have a list of children, your Addon will be of type single since each item in the list represents a single child.

  • Hanan Radwan
    Options

    To ensure best practice, I would like to clarify whether it is more appropriate to create a new record for each child in the parents table or link the parent ID from the user table with each child in the students table. Could you please advise me on the recommended approach?

  • Hanan Radwan
    Options

    The result I wanted was achieved
    Even though I don't know if the API's output is correct, I now have all the information I need

    Is it possible to change its appearance without customizing it?
    I want any new field I insert to be automatically added to the API

    One more thing
    This image shows how I need multiple data from two tables for each student
    What is the best practice here, in your opinion?

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Any new field will be added to the API if you do not check the box customize response. It will default to include all fields this way.

    And you are able to do multiple Addons on any API so if you have related data in multiple tables, you can do multiple Addons