Output of gift of any constituent was between 365 and 372 days ago

Hi all,

I'm trying to create a query in Raiser's Edge NXT that produces an output where gift of any constituent was between 365 and 372 days ago. I need the result to be dynamic. Since there's not a feature in the Criteria section where I can write Between Today - 365 days and Today -372 days I'm finding it quite tricky. Since I need the result to be dynamic I can't use merge query. Tried also using Select from query in the Record processing feature.

Help please!

Many thanks!

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge

    @Robert BenjaminLaing
    use Adhoc query via Query API. generate dynamically the date range via addDays() expression that will give you 365 days ago and 372 days ago dynamically, then use these 2 dates as criteria on gift date

  • @Alex Wong

    Hi Alex

    thanks for all the help in my previous issue and this one too.

    Could you confirm please that this JSON is correct. I have very little using/handling it and the JSON im running is returning a “bad request ” error even before putting in my Compose action outputs. Before the ad hoc query action the inputs for my compose and compose 1 actions were respectively "addDays(utcNow(), -365", 'yyyy-MM-dd')" and addDays(utcNow(), -372, 'yyyy-MM-dd') Please also note that I have added the criteria Total Amount of Gifts ≥ £1000. so my criteria is “Last Gift Date ” between (365 days ago and 372 days ago) AND Total Amount of Gifts ≥ £1000.

    my JSON below:

    {{

    "query": {

    "select_fields": [

    {

    "query_field": {

    "id": 425,

    "available_field_name": "Constituent ID",

    "selected_field_name": "Constituent ID",

    "value_type": "Text",

    "one_to_many": false,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "summary_has_available_fields": false,

    "summary_has_default_filters": false

    }

    },

    {

    "query_field": {

    "id": 424,

    "available_field_name": "First Name",

    "selected_field_name": "First Name",

    "value_type": "Text",

    "one_to_many": false,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "summary_has_available_fields": false,

    "summary_has_default_filters": false

    }

    },

    {

    "query_field": {

    "id": 422,

    "available_field_name": "Surname",

    "selected_field_name": "Surname",

    "value_type": "Text",

    "one_to_many": false,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "summary_has_available_fields": false,

    "summary_has_default_filters": false

    }

    },

    {

    "query_field": {

    "id": 68586,

    "available_field_name": "Gift Date",

    "selected_field_name": "Last Gift Date",

    "value_type": "Date",

    "one_to_many": false,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "summary_has_available_fields": false,

    "summary_has_default_filters": false

    }

    }

    ],

    "filter_fields": [

    {

    "query_field": {

    "id": 68586,

    "available_field_name": "Gift Date",

    "selected_field_name": "Gift Date",

    "value_type": "Date",

    "one_to_many": false,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true

    },

    "compare_type": "None",

    "filter_values": [

    "compose action output i insert ",

    "compose 1 action output i insert "

    ],

    "operator": "Between",

    "left_parenthesis": false,

    "right_parenthesis": false

    },

    {

    "query_field": {

    "id": 71937,

    "available_field_name": "Total Amount of Gifts",

    "selected_field_name": "Total Amount of Gifts",

    "value_type": "Summary",

    "one_to_many": true,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "allowed_filter_operators": ["Equals", "DoesNotEqual", "RelativeComparisons", "OneOf"],

    "summary_value_type": "Text",

    "summary_has_available_fields": true,

    "summary_has_default_filters": false

    },

    "compare_type": "None",

    "filter_values": ["£1,000.00"],

    "operator": "GreaterThanOrEqualTo",

    "left_parenthesis": false,

    "right_parenthesis": false,

    "summary_instance": 1

    }

    ],

    "sort_fields": [

    {

    "query_field": {

    "id": 71937,

    "available_field_name": "Total Amount of Gifts",

    "selected_field_name": "Total Amount of Gifts",

    "value_type": "Summary",

    "one_to_many": true,

    "output_sort_can_add_edit": true,

    "criteria_can_add_edit": true,

    "execute_by_id_supported": true,

    "allowed_filter_operators": ["Equals", "DoesNotEqual", "RelativeComparisons", "OneOf"],

    "summary_value_type": "Text",

    "summary_has_available_fields": true,

    "summary_has_default_filters": false

    },

    "sort_order": "Ascending",

    "summary_instance": 1

    }

    ],

    "gift_processing_options": {

    "soft_credit_option": "Donor",

    "matching_gift_credit_option": "Donor",

    "use_gross_amount_for_covenants": false

    },

    "advanced_processing_options": {

    "use_alternate_sql_code_table_fields": false,

    "use_alternate_sql_multiple_attributes": false

    }

    }

    }

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge

    @Robert BenjaminLaing
    I don't know how you created the JSON, but it is definitely not correct, which is the reason for the bad request error.

    I think I answer you on another post already on what a good JSON for adhoc query request looks like.