Title: Computed Columns
Last modified: September 10, 2020

---

# Computed Columns

 *  Resolved [samonpress](https://wordpress.org/support/users/samonpress/)
 * (@samonpress)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/computed-columns/)
 * First of all, WP Data Access is an amazing tool and I’m really enjoying building
   projects on it. I was wondering if its possible to create computed columns within
   Data Designer module itself?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/computed-columns/#post-13387810)
 * Hi [@samonpress](https://wordpress.org/support/users/samonpress/),
 * >>> I was wondering if its possible to create computed columns within Data Designer
   module itself?
 * You could use the Data Designer to add a column to your table and use it to store
   computed values. Strickly spoken however, computed values can be computed and
   should as such not be stored I think, although you might have reason to do so.
 * I guess a view would be more applicable, or a feature in Data Projects and/or
   the Data Publisher. Unfortunately, both are not (yet) avialable. Sorry! But they
   are on my to do list… 😉
 * Best regards,
    Peter
 *  Thread Starter [samonpress](https://wordpress.org/support/users/samonpress/)
 * (@samonpress)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/computed-columns/#post-13395726)
 * Hi Peter!
 * Looking forward to that feature! For now, can creating a trigger be an alternative
   solution to this situation?
 * Actually, I want to save the computed value because the numbers used for calculation
   will change time to time. However, the computed number which shows up on the 
   day will be our promise to the other party.
 * I’ve been trying to use this trigger statement which is not going through.
 *     ```
       CREATE OR REPLACE TRIGGER grand_trigger
       BEFORE INSERT ON termsheet_db
       FOR EACH ROW
       WHEN INSERTING THEN
       INSERT INTO termsheet_db(grand_totalamt) VALUES (NEW.grandtotal_amt+100),
       END;
       ```
   
 * Need help!
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/computed-columns/#post-13398598)
 * Hi [@samonpress](https://wordpress.org/support/users/samonpress/),
 * You cannot insert a new row into a table in a before insert trigger. This would
   create an infinite loop. Try this:
 * SET NEW.grandtotal_amt= NEW.grandtotal_amt + 100;
 * Best regards,
    Peter
 *  Thread Starter [samonpress](https://wordpress.org/support/users/samonpress/)
 * (@samonpress)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/computed-columns/#post-13402512)
 * Thank you! That worked.
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/computed-columns/#post-13402750)
 * Great! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Computed Columns’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/computed-columns/#post-13402750)
 * Status: resolved