• Resolved andywt

    (@andywt)


    To produce a specific report I wrote a custom function to determine idf the record has an email. The function works fine with the cfdb-datatable but when I use the same filter in an cfdb-exportlink, it does not work. Here is the short code that works with the datatable:

    [cfdb-datatable  form="2015 Flag Database"  edit="$_GET(edit)" show="FirstName,LastName,Email,HouseNumber,Street,UniqueID, Renew_status" trans="NaturalSortByMultiField($_GET(sortBy1),$_GET(sortBy2),$_GET(sortBy3),$_GET(sortBy4),$_GET(sortBy5))"
    filter="has_valid_email()&&Route>=$_GET(routeS)&&Route<=$_GET(routeE)&&Renew_status!=Renewed&&Renew_status!=Removed"

    Now here is the same code for the export-link:

    [cfdb-export-link  form="Flag Database"  edit="$_GET(edit)" show="FirstName,LastName,Email,HouseNumber,Street,UniqueID, Renew_status" trans="NaturalSortByMultiField($_GET(sortBy1),$_GET(sortBy2),$_GET(sortBy3),$_GET(sortBy4),$_GET(sortBy5))"  filter="has_valid_email()"  filter="has_valid_email()&&Route>=$_GET(routeS)&&Route<=$_GET(routeE)&&Renew_status!=Renewed&&Renew_status!=Removed"    ]

    When the export-link is executed it returns no data. If I remove the custom function in the filter it does return data.

    https://ww.wp.xz.cn/plugins/contact-form-7-to-database-extension/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    2nd short code
    – References a different form name
    – You have 2 “filter” entries
    – In “show you have a space in ” Renew_status”
    – Can remove “edit” option

    Can’t compare short codes with different options.

    Thread Starter andywt

    (@andywt)

    Michael,
    Sorry I posted the wrong second short code. To create the the export shortcode, I copied the datatable in total and changed cfdb-datable to cfdb-export-table. My new code did have edit and it did have the space before Renew_status as that worked fine with the datatable. I removed the edit and the extra space and this is the shortcode:
    [cfdb-export-link form="2015 Flag Database" show="FirstName,LastName,Email,HouseNumber,Street,UniqueID,Renew_status" trans="NaturalSortByMultiField($_GET(sortBy1),$_GET(sortBy2),$_GET(sortBy3),$_GET(sortBy4),$_GET(sortBy5))" filter="has_valid_email()&&Route>=$_GET(routeS)&&Route<=$_GET(routeE)&&Renew_status!=Renewed&&Renew_status!=Removed" ]

    This does not return any values in the CSV file. If I remove “has_valid_email()” from the filter results are returned.

    Plugin Author Michael Simpson

    (@msimpson)

    And if you change cfdb-export-link to cfdb-datatable (with all the same options) then you do get results?

    Thread Starter andywt

    (@andywt)

    Yes.

    Plugin Author Michael Simpson

    (@msimpson)

    OK, I think I know what is going on. The export link is an admin (Dashboard) page URL. So go to where you created your custom function in SAF, check the “Execute also on Dashboard Pages” box and save.

    Thread Starter andywt

    (@andywt)

    Victory!! That was it. Thanks much.

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

The topic ‘Filter issues with cfdb-export-link’ is closed to new replies.