Title: Transform function
Last modified: August 31, 2016

---

# Transform function

 *  [andywt](https://wordpress.org/support/users/andywt/)
 * (@andywt)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/)
 * In my database, I have a money field that includes a monetary symbol ($) that
   comes from a Gravity form. When I tried to do the function “sum” on that field,
   it won’t add the field. To get around this i tried to use a transform function
   to remove the “$”:
 *     ```
       [cfdb-value form="Flag Database" trans="FlagLeasePrice=str_replace('$','',FlagLeasePrice)" function="sum" show="FlagLeasePrice"]
       ```
   
 * but it made no difference.
 * Any suggestions?
 * [https://wordpress.org/plugins/contact-form-7-to-database-extension/](https://wordpress.org/plugins/contact-form-7-to-database-extension/)

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

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/#post-7152434)
 * The single quotes don’t work. Try:
    `[cfdb-value form="Flag Database" trans="
   FlagLeasePrice=str_replace($,,FlagLeasePrice)" function="sum" show="FlagLeasePrice"]`
 * If that doesn’t work, take out the function=”sum” to see what it is actually 
   giving you for FlagLeasePrice.
 * I’m not sure if `function="sum"` will play well with the transform. You might
   need to remove function=”sum” and replace it with a transform that does the sum.
 * `trans="FlagLeasePrice=str_replace($,,FlagLeasePrice)&&SumField(FlagLeasePrice)"`
 *  Thread Starter [andywt](https://wordpress.org/support/users/andywt/)
 * (@andywt)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/#post-7152444)
 * I changed the shortcode to `[cfdb-value form=”Flag Database” trans=”FlagLeasePrice
   =str_replace(“$”,””,FlagLeasePrice)” show=”FlagLeasePrice”]’
    and FlagLeasePrice
   continue to show the $.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/#post-7152449)
 * You didn’t take out the quotes. Try what I gave you.
 *  Thread Starter [andywt](https://wordpress.org/support/users/andywt/)
 * (@andywt)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/#post-7152454)
 * Sorry Mike. Tried that and the FagLeasePrice goes to “”.
    Here is the printout
   without the transform:
 * [no transform printout](https://www.dropbox.com/s/8kr5mwu7a39mgur/no%20transform.png?dl=0)
 * Here is the shortcode with the transform and the printout:
    `[cfdb-datatable 
   form="Flag Database" trans="FlagLease=str_replace($,,FlagLeasePrice)" show="FlagLease"]`
   [transform printoiut](https://www.dropbox.com/s/8b4knbtm38gci2y/transform.png?dl=0)
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/transform-function/#post-7152520)
 * I think there is a bug parsing that empty value. I’ll fix this shortly.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/transform-function/#post-7152546)
 * Try it with version 2.10.2 which should be available in a little while.
 *  Thread Starter [andywt](https://wordpress.org/support/users/andywt/)
 * (@andywt)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/transform-function/#post-7152550)
 * Michael,
    The parsing issue is fixed but there seems to be another issue. I am
   using the cfdb-value to produce some stats about the database. I was using:
 *     ```
       [cfdb-value form="Flag Database" filter="payment_status=Paid"
       function="count" show="payment_status"]
       ```
   
 * To count the number of records that are marked Paid. It produces a number but
   it doesn’t reconcile to what I compute using an Excel dump of the file. What 
   I found was the filter does not work. I tried search and got the same result.
   I then change the shortcode to cfdb-datable with all the rest the same and the
   results show that the filter is not working. Here is a dump of the output:
    [Filter Debug Dump](https://www.dropbox.com/s/ubxo7k6pkv9wf0e/filterdebug.png?dl=0)
 * I know the filter works as I use it to produce other reports.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/transform-function/#post-7152562)
 * I’m not sure what is going on here. Make sure there is no line break inside the
   short code. If the filter part appears on a 2nd line, it might not be read.

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

The topic ‘Transform function’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/transform-function/#post-7152562)
 * Status: not resolved