Init hook question
Posted: 2019-07-24 07:02
Dear Appgini forum,
does anyone an idea for solving the following problem:
- I'm using Appgini 5.75
- Within my Appgini application I have a table, let's call it products.
- This table has the fields: ID, CREATEDDATE, VALID_TO, STATUS,...
- ID: primary key, CREATEDDATE: date, VALID_TO: date, STATUS: varchar (10)
- I would like to update the STATUS field every time when a user calls the Table views from "products" as follows:
>> If ((the date from today) - (VALID_TO)) < 0 then STATUS = "OK"
>> If ((the date from today) - (VALID_TO)) => 0 then STATUS = "NOT OK"
- I tried to implement the condition above in the tablename_init hook, so when the Tableview from the table "products" is called the STATUS fields are showing the updated values (OK, NOT OK etc.)
- But however I could not find a way how to retrieve each data from the table "products" within the foreach loop to implement the conditions above and update the STATUS field!
Anyone a hint for me?
PS:
1. The tutorial under https://bigprof.com/appgini/tips-and-tu ... eview-data was unfortunately not a help for me ;-(
2. I did not understand how to use the DataList-object under https://bigprof.com/appgini/help/advanc ... ist-object
Thx a lot
Yilmaz
does anyone an idea for solving the following problem:
- I'm using Appgini 5.75
- Within my Appgini application I have a table, let's call it products.
- This table has the fields: ID, CREATEDDATE, VALID_TO, STATUS,...
- ID: primary key, CREATEDDATE: date, VALID_TO: date, STATUS: varchar (10)
- I would like to update the STATUS field every time when a user calls the Table views from "products" as follows:
>> If ((the date from today) - (VALID_TO)) < 0 then STATUS = "OK"
>> If ((the date from today) - (VALID_TO)) => 0 then STATUS = "NOT OK"
- I tried to implement the condition above in the tablename_init hook, so when the Tableview from the table "products" is called the STATUS fields are showing the updated values (OK, NOT OK etc.)
- But however I could not find a way how to retrieve each data from the table "products" within the foreach loop to implement the conditions above and update the STATUS field!
Anyone a hint for me?
PS:
1. The tutorial under https://bigprof.com/appgini/tips-and-tu ... eview-data was unfortunately not a help for me ;-(
2. I did not understand how to use the DataList-object under https://bigprof.com/appgini/help/advanc ... ist-object
Thx a lot
Yilmaz