Search code examples
mysqlgoogle-apps-scriptgoogle-cloud-sqlgoogle-app-maker

How to create a view?


I'm pretty new in App Maker. I want to create an app that will collect various types of request (failures, new ideas, orders and so on ). For each type of request will be separate data model. Every data model (request) contains 3 the same information: date, applicient, comments.

In addition to the dashboard's stand for each type of request, I want to make one in which all entries will be displayed with only repating records and type of request as one more record (date, applicient, comments, type of request)

I think that Calculated Model is the answer here, but despite getting acquainted with the documentation, I don't know how to implement this in my case. Could anybody halp me with this ? Below I am presenting the display of the above description. Records 1, 2, 3 ... presents records that don't replicate in another data model.

IMAGE:

https://drive.google.com/file/d/1gi6ylZacOVSkcqtpaupRpIOrzbq7fOsT/view?usp=sharing

I tried to do relations, but I couldn't displey this in one table, what is my goal. How to conigure the SQL datasource to do this ?


Solution

  • You can create a new calculated SQL model with UNION:

    (SELECT 'Failures' AS REQUEST_TYPE, C.* FROM Failures AS C)
    UNION ALL
    (SELECT 'New Ideas', C.* FROM `New ideas` AS C)
    UNION ALL
    (SELECT 'Orders', C.* FROM Orders AS C);
    

    You must have corresponding fields in your datasource that match the sql column names: REQUEST_TYPE, Date, Applicient, Comments

    Reference: