• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

How to return values in an array if another value is true?

greco26

Member
I have the following json with 3 separate records. Currently I am using Pabbly Iterator to iterate through the outer array and then another iterator step to iterate through the nested array. I then take the data in the second (nested) array and put each record into Google sheets just to find out which record has "isUS"==true. If true, then return the "conid" of the same record so that I can use it in the next Pabbly step.

I feel is there is a much easier way for me to extract the correct conid than this process I just reviewed. Ideally I can accomplish this all within Pabbly. Let me know if there is a better way within Pabbly to do this. Thanks!!


[
{
"name": "ANGLO AMERICAN PLC",
"chineseName": "英美公司",
"assetClass": "STK",
"contracts": [
{
"conid": 45024954,
"exchange": "LSE",
"isUS": false
}
]
},
{
"name": "AMERICAN AIRLINES GROUP INC",
"chineseName": "美国航空集团公司",
"assetClass": "STK",
"contracts": [
{
"conid": 139673266,
"exchange": "NASDAQ",
"isUS": true
}
]
},
{
"name": "AVIAAM LEASING AB",
"chineseName": "AviaAM租赁集团",
"assetClass": "STK",
"contracts": [
{
"conid": 285940697,
"exchange": "VALUE",
"isUS": false
}
]
}
]
 
P

PabblyMember4

Guest
Hey @greco26

Could you please let me know the workflow name where you have tried the above scenario?
 

greco26

Member
Hi, the name of the work flow is Simple-STRAT Workflow. I using a router so the particular route is call IBRK NEW.
 

greco26

Member
Basically, I want to know how I can find the record in the nested array and return the conid of the record only if isUS is true.
 
P

PabblyMember4

Guest
Hey @greco26

I have implemented the code by python in your workflow and implemented the logic when IsUS == true then it will return the conid that you can use in the next step. Kindly check the below screenshot:-

1686117551105.png


1686117600099.png


You can use the conid in the next steps. I also deleted the iterator steps as these steps are of no use in the workflow.

Kindly check and let me know if you have any question or comments.

Thanks
Kunal
 

greco26

Member
Hi, while the value is properly being returned in the code step, it is not being passed in the next steps. Please see the error below. Thanks,


1686143707172.png


1686143567442.png


1686143525538.png
 
P

PabblyMember4

Guest
Hey @greco26

We have checked the issue and found that Python code was passed to the code by the Pabbly module as a blank string that's the reason it got failed for this record. Kindly monitor the scenario for a couple of days and let us know if you got the same issue in any other data.
 

greco26

Member
Hi @Kunal

I've continued to test it all day today with different records and it come back blank still. Why would the value show in the output however not get passed along to use in the next step?
 

greco26

Member
Yes and perhaps Pabbly can figure out why Code by Pabbly isn’t working properly for the existing Python code since it’s providing the exacted output already.
 
P

Pabblymember11

Guest
Proficiency in coding is essential for successfully executing this step, as it relies on programming skills. However, we encourage you to explore and experiment with it freely. It's important to keep in mind that no technical support will be available for code-related errors.

To ensure a smooth experience, we highly recommend thoroughly reviewing the comprehensive Code experience, which provides valuable insights and detailed information to assist you in your coding journey.
 

greco26

Member
I figured a way to get the data into google sheets and then select the correct cell with the data I need. Now, the problem is that Iterator sends the data for each loop it runs. I reviewed the following post however I'm still not clear on the final explanation and how to only have the data sent one time in the next steps of the flow instead of n of times.

 

greco26

Member
FYI, I have hit dead ends all day trying to figure out how to get this working. I moved away from Python and Java because I dont know them and I know I should be able to get this to work without any coding.

The name of the flow is Simple-STRAT Workflow and the Route is IBKR New. I run test data to the flow from Test Order flow. The main record the flow uses is the Symbol (stock market ticker). I have 2 iterators running back to back because I have a nested array which I also need to iterate. I am able to iterate through the arrays and push the data from all the arrays to sheets.

Then the next step the process is im doing a sheets lookup from Pabbly, finding the row that is 'True' and returning the ID in that row (3691937 in the example below) then inserting that into the next step which is to send a Post request. This is where things break for me. 1) 5 Post requests are being sent instead of just 1. Im sure it's because of my iterator setups so im hoping a filter or something can help me with that. 2) the row value record im pulling from sheets is blank when it comes back to Papply just like the Python script was returning.

The odd thing is that when I send a test record for the Post request from the Pabby flow, it works. When I send live data, the record coming from sheets is blank. Im working if it has something to do with the iterator still running while its pulling the record.

Any help would be super!!






1686289049092.png




1686289487091.png


1686289603829.png



TEST RECORD WORKS FINE
1686289897233.png
 
P

Pabblymember11

Guest
The odd thing is that when I send a test record for the Post request from the Pabby flow, it works. When I send live data, the record coming from sheets is blank. Im working if it has something to do with the iterator still running while its pulling the record.
Can you share the task history ID in which you have noticed the blank response from Google Sheets?
 

greco26

Member
Certainly. Here are 2. I have many more if needed.

IjU3NjAwNTZiMDYzMDA0M2M1MjZmNTUzMjUxM2E1MTYyNTQzMiI_3D_pc
Task History ID -

IjU3NjAwNTZiMDYzMDA0M2M1MjZmNTUzMjUxMzY1MTY2NTQzNSI_3D_pc​

 
P

Pabblymember11

Guest
Please allow us sometime, we are currently looking into it.
 
Top