Import filter with many records from the export
I have many records being sent over from the export side and I need to filter them out to the first import. I can build a filter "loop" to go through each one and determine if it should be handled by the first import or passed onto the next. Does the filter stop after either the first return true or false or will it actually cycle through the array and hand off the "true" conditions to the import and the false conditions to the next destination?
0
Comments
The filer will loop through all records if they are members of the records array. You can't filter on elements of nested arrays without using the 1 to Many options in your import. A sample of the data would be helpful.
Thanks for the quick response!!!
Here is the top part of the data coming from the export after I have "manipulated it in the hook:
{
"trans": [
{
"tran": {
"BusinessDate": 20220217,
"StoreId": 21,
"TerminalId": "1",
"TransactionId": 6932,
"IsPostVoided": false,
"Ecommerce": null,
"TransactionType": "Sale",
"TranType": {
"IsSale": true,
"IsReturn": false,
"IsExchange": false,
"IsLayaway": false,
"IsSpecOrder": false,
"IsEmployee": false,
"IsFunction": false,
"IsVoidDur": false,
"IsSuspended": false
},
"TranFlags": {
"IsPostVoid": false,
"IsClockIn": false,
"IsClockOut": false,
"IsLogOff": false,
"IsLogOn": false,
"IsOverride": false,
"IsOpenDrawer": false,
"IsReprintEJ": false,
"IsReprint": false,
"IsTotalNeg": false,
"IsOffLine": false,
"IsDirectBill": false,
"IsCelebClub": false,
"IsHalfPriceTGL": false,
"IsHandRcpt": false,
"IsPowerOff": false,
"IsPhoneOrder": false,
"IsImported": false,
"IsEcomm": false
},
"FunctionInfo": null,
"SystemDate": 20220217,
"SystemTime": 151910,
"StartTime": 151905,
"EndTime": 151910,
"Version": "7.51",
"SubTotal": 1.49,
"TaxTotal": 0,
"GrossTotal": 1.49,
"TenderTotal": 1.49,
"CashierId": "11111",
"SalesPerson": "",
"EmployeeId": "",
"EmployeeInfo": {
"CashierId": "11111",
"Name": "STORE MANAGER SC1",
"EmployeeId": "",
"FamilyName": ""
},
"ExchangeInfo": null,
"AwardPoints": 0,
"TotalPoints": 0,
"Items": [
{
"LineNum": 1,
"ItemFlags": { .........
When I go to the filter it adds the "record" and "_PARENT" to the incoming records:
{
"record": {
"_PARENT": {
"trans": [
{
"tran": {
"BusinessDate": 20220217,
"StoreId": 21,
"TerminalId": "1",
"TransactionId": 6932,
"IsPostVoided": false,
"Ecommerce": null,
"TransactionType": "Sale",
"TranType": {
"IsSale": true,
"IsReturn": false,
"IsExchange": false,
"IsLayaway": false,
"IsSpecOrder": false,
"IsEmployee": false,
"IsFunction": false,
"IsVoidDur": false,
"IsSuspended": false
}, .....
So my first "filter" is to let the "Sales" stay and be added to NS via the "Cash Sale" and then pass the remaining off to the next destination that sets them up for "Cash Refund." So I need to look at each "parent" array element - which would be "_PARENT.trans.tran" to determine if that "tran" should stay or move on to the next destination. Also I have the "path to many" set to _PARENT.trans[*].tran.Items[*].
I think I get the use case.
Your data is a webhook with 1 record that contains a trans array with many transactions in that array. If that's accurate, your path to many should be "trans". Your data set will then look like it has many records in it and I think the _PARENT element will be empty. You can then filter on tran.TranType.IsSale = true to process the sales. Hope this helps.
Thanks again for your help
I have another nested array that I need to use to add the "items" within each "tran" to the NetSuite" sale. If I setup the "many" to back up one array as you suggest, then how do I access each "item" to add them to the NS cash sale? The Items array is at the bottom of the first data example...
David,
Here is the filter for the condition. My question is will Celigo call this for each record in the array?
I never use script filters. I do know whatever array is at the target of the one-to-many will be looped over by celigo with standard filters.
Please sign in to leave a comment.