Creating and using a View

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
RonP
Veteran Member
Posts: 258
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Creating and using a View

Post by RonP » 2025-05-02 13:36

Hi,
Is there a simple way to create a view within Appgini?
Wat I do now is:
- within Mysql I create a view
- save the MySql code in notepad
- delete the view

Now I have to make that view known in the application.
- create in the application a new table —-> becomes a physic table in Mysql database with the wanted View name
- generate a project.
All the wanted “view” files where created

After login to the the project in a browser you see the table, where I like to see and use the view.
- So I delete the table in Mysql and create the wanted view with the right name. ( view name = generated table name)

When I try to execute the view nothing happens, in the Admin area I see MySql defenition Errors.
I try to have it fixed, no result.

So… I have view, within the project show as a table but I cann’t use this because off unfixable errors.

There must be a much easyer way to handle views.
Ron

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1709
Joined: 2018-04-01 10:12

Re: Creating and using a View

Post by pbottcher » 2025-05-03 06:54

Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 258
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Creating and using a View

Post by RonP » 2025-05-04 14:29

Hi pbottcher,

And again, you helped me out, thank you!

Beneath I state what I did, maybe useful for others, so one don't have to go years back.
(by the way: a search action within the forum(s) sucks, it gives: to busy )

My steps:
Create a table of which you want a view of within AppGini
Save project and generate

Go to MySql environment
Create the desired view, with a different name than the table name (table- and view names should be unique)

Code: Select all

Create view `view name` AS Select * from  `<table name>`
After this a view has been created however with a not desired name
Stay in MySql environment
Delete the, by AppGini, generated table of which you like to have the view of

Code: Select all

Delete `<table name>`
Change the name of the view to the former table name, you still are in the Mysql environment
The most simple way of doing this is:
(still within MySql)

Code: Select all

Rename  table `old view` to `new name`[code]
After this you should be able to work with the view
Don't forget to the delete the not wanted view!

Goodluck
Ron

Post Reply