• Resolved growinsane

    (@growinsane)


    Hi there,
    Your example of exporting says to append the parameters as follows:
    &action=export&export_type=custom&export_delimiter=#
    Is there a parameter to supply a field?
    So for example can I
    1. Setup the query as :
    SELECT * FROM wp_postmeta WHERE %%WHERE%%
    2. Setup a number field as post_id
    and then report out with json using this post_id field like so?
    report=#&full=1&action=json&token=#&export_type=json&post_id=100000
    This didn’t work but this be done?
    David,
    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter growinsane

    (@growinsane)

    Just as work around to doing this (because I could not see evidence it was possible)
    If in the API.php file this line :
    $options[‘sql’] = trim( $report_data[‘sql_query’] );

    is substituted with this block :

    $ID = absint( $_GET[‘ID’] );
    if (empty($ID))
    {
    $options[‘sql’] = trim( $report_data[‘sql_query’] );
    }
    else{
    $options[‘sql’] = ‘select * from (‘ . trim( $report_data[‘sql_query’] ) . ‘) as X where ID = ‘ . $ID;
    }

    …it then becomes possible to supply ID as a parameter in the query string and provided the saved report includes a column with name or alias ‘ID’ it will subquery against the report. I am not sure if this breaks other functionality but it worked for me. It could be refined if performance is critical as it is querying what would be an unrestrained subquery.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Have you tried adding ID as a field/column not shown/exported, but filterable? Then you could do this without any workarounds.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter export example’ is closed to new replies.