This topic is locked

Edit Page to look at a Table whose structure dynamically changes?

8/31/2024 11:33:37 AM
ASPRunnerPro General questions
C
Conrunner author

Hello

I wonder if anybody could help. I have a table for which I need an edit page but the difficulty is that the columns in the table do not always remain the same. The user adds a record to the table which later needs to be edited, but there is a stored procedure which triggers once the record has been added in order to drop any NULL or empty columns within that record (there is only one record in the table at any one time). The reason for this is that, when the record comes to be edited, I don't want any empty or null fields visible; just the populated ones.

To simplify things, say the record had only 2 columns; A and B
If the user populates A and leaves B NULL, then SELECT * FROM TABLE after the SP has been triggered returns A only because the B column has been dropped and vice versa.

If I set up an edit page in ASPRunner Pro however, the query which is generated seems to be SELECT A, B from TABLE so that, if either A or B are missing, then there is an error because one of the columns cannot be found.

If I change the query to SELECT * from TABLE in ASPRunner Pro this seems to work within the programme, but when I upload the application to the server, the query seems to have reverted to SELECT A, B from TABLE again so that again, if one of the columns is missing, then an error is thrown.

As I say, the reason for the SP to drop the empty columns is that I dont want them visible on the edit page, but I cannot figure out how to code the edit page itself to hide NULL or empty fields.

Many Thanks

Con

Sergey Kornilov admin 9/2/2024

ASPRunnerPro and our other software requires that database structure is known at the design time. The lion's share of the code is tied to specific field names and if you add a new column later, our software will not be able to work with new column on any of the pages.

If your problem is mostly hiding fields on the Edit page based on some condition, check this API:
https://xlinesoft.com/asprunnerpro/docs/hidefield.htm

fhumanes 9/3/2024

Hello,

All those who tell you Sergey is totally correct.

However, Phprunner can extend to do many more functions than the product directly proposes.

In this example, forms can be defined (in this case surveys) and collect their data and save them in JSON format, which is an easily treatable format. In the example you can see that it can be exported to Excel, but anything can be done.

https://fhumanes.com/blog/integracion/gestion-de-encuestas-integracion-surveyjs/

The problem is that this system (which I do not know if it is valid for you) requires having knowledge of programming in PHP.

Greetings,
fernando