Why is the Workflow not processing the False part of IF?

I have build the following workflow.

In this work flow I want to loop as many as necessary but it is skipping the False part of IF node.

I have draw arrows to show the path of execution.

How can I get the Workflow to process both parts of IF before proceeding further?

Would it be necessary to flatten the Workflow?

Hi @YogiYang :wave:

Would you be able to share your workflow with us so we can understand the kind of data its processing? You can do that by hitting ctrl/cmd + a whilst on the workflow editor to select all nodes, and then ctrl/cmd + c to copy them. From there, you can paste your workflow between two sets of three backticks (```) here on the forums.

Otherwise, can you give some example data / an example workflow? :eyes:

I’ve had issues similar to this. To fix it for my issues, I’ve added a Merge node using the append type.

1 Like

Here is the complete workflow copy pasted as per your instructions.

1 Like

Hi @YogiYang :wave: I’ve edited your workflow - you accidentally exposed some API keys, so you may want to rotate those, but they’re no longer accessible :bowing_man:

Could you provide an example of some data in JSON format that you would have expected to trigger the false part of the IF statement? Also out of curiosity, did the suggestion from @Philip_Wiggins up thread for adding a Merge node using Append help you out?

Hello,

Here is the input JSON data

[
  {
    "permittype": "BP",
    "permit_type_desc": "Building Permit",
    "permit_number": "2022-016859 BP",
    "permit_class_mapped": "Commercial",
    "permit_class": "C-1000 Commercial Remodel",
    "work_class": "Remodel",
    "condominium": "No",
    "permit_location": "301 CONGRESS AVE UNIT 900",
    "description": "Interior remodel in existing admin office",
    "tcad_id": "0205020601",
    "legal_description": "LOT 12712  W18'OF LT 3 BLOCK 030 ORIGINAL CITY PLUS VAC 20 FT ALLEY  059 AC OF VAC ST TOTAL SQ FT 69943",
    "applieddate": "2022-01-03T00:00:00.000",
    "issue_date": "2023-03-02T00:00:00.000",
    "day_issued": "THURSDAY",
    "calendar_year_issued": "2023",
    "fiscal_year_issued": "2023",
    "issued_in_last_30_days": "No",
    "issue_method": "Permit Center",
    "status_current": "Final",
    "statusdate": "2023-04-21T14:29:52.000",
    "expiresdate": "2023-04-21T00:00:00.000",
    "completed_date": "2023-04-21T00:00:00.000",
    "remodel_repair_sqft": "3072",
    "total_valuation_remodel": "0",
    "number_of_floors": "1",
    "housing_units": "1",
    "building_valuation_remodel": "0",
    "electrical_valuation_remodel": "0",
    "mechanical_valuation_remodel": "0",
    "plumbing_valuation_remodel": "0",
    "medgas_valuation_remodel": "0",
    "original_address1": "301 CONGRESS AVE UNIT 900",
    "original_city": "AUSTIN",
    "original_state": "TX",
    "original_zip": "78701",
    "council_district": "9",
    "jurisdiction": "AUSTIN FULL PURPOSE",
    "link": {
      "url": "https://abc.austintexas.gov/web/permit/public-search-other?t_detail=1&t_selected_folderrsn=12872741"
    },
    "project_id": "12872741",
    "masterpermitnum": "12854054",
    "latitude": "30.26537578",
    "longitude": "-97.74353468",
    "location": {
      "latitude": "30.26537578",
      "longitude": "-97.74353468",
      "human_address": "{\"address\": \"\", \"city\": \"\", \"state\": \"\", \"zip\": \"\"}"
    },
    "contractor_trade": "General Contractor",
    "contractor_company_name": "The Mapp group",
    "contractor_full_name": "May Vlaming",
    "contractor_phone": "5126265434",
    "contractor_address2": "832  CONGRESS AVENUE",
    "contractor_city": "AUSTIN",
    "contractor_zip": "78738",
    "applicant_full_name": "May Vlaming",
    "applicant_org": "The Mapp group",
    "applicant_phone": "5126265434",
    "applicant_address2": "832  CONGRESS AVENUE",
    "applicant_city": "AUSTIN",
    "applicantzip": "78738",
    "certificate_of_occupancy": "Yes"
  }
]

We need extract each records and check the database if the permit_number exists or not.
For checking if a permit_number exist I was actually using only the count SQL on Supabase but for some reason n8n did not recognize this value so I create a query in which all the fields in the table are returned with null value except for the ID field. This ID field contains the count returned by Supabase.

Here is the sample of JSON that Supabase returns.

[
  {
    "id": 1,
    "permittype": null,
    "permit_type_desc": null,
    "permit_number": null,
    "permit_class_mapped": null,
    "permit_class": null,
    "work_class": null,
    "condominium": null,
    "permit_location": null,
    "description": null,
    "tcad_id": null,
    "applieddate": null,
    "issue_date": null,
    "day_issued": null,
    "calendar_year_issued": null,
    "fiscal_year_issued": null,
    "issued_in_last_30_days": null,
    "issue_method": null,
    "status_current": null,
    "statusdate": null,
    "expiresdate": null,
    "remodel_repair_sqft": null,
    "number_of_floors": null,
    "housing_units": null,
    "original_address_1": null,
    "original_city": null,
    "original_state": null,
    "original_zip": null,
    "council_district": null,
    "jurisdiction": null,
    "project_id": null,
    "masterpermitnum": null,
    "latitude": null,
    "longitude": null,
    "contractor_trade": null,
    "contractor_company_name": null,
    "contractor_full_name": null,
    "contractor_phone": null,
    "contractor_address_2": null,
    "contractor_city": null,
    "contractor_zip": null,
    "certificate_of_occupancy": null,
    "legal_description": null,
    "applieddate_new": null,
    "issue_date_new": null,
    "statusdate_new": null,
    "expiresdate_new": null,
    "contractor_address_1": null,
    "project_name": null,
    "completed_date": null,
    "total_existing_bldg_sqft": null,
    "total_new_add_sqft": null,
    "link": null,
    "completed_date_new": null,
    "applieddate_new_new": null
  },
  {
    "id": 0,
    "permittype": null,
    "permit_type_desc": null,
    "permit_number": null,
    "permit_class_mapped": null,
    "permit_class": null,
    "work_class": null,
    "condominium": null,
    "permit_location": null,
    "description": null,
    "tcad_id": null,
    "applieddate": null,
    "issue_date": null,
    "day_issued": null,
    "calendar_year_issued": null,
    "fiscal_year_issued": null,
    "issued_in_last_30_days": null,
    "issue_method": null,
    "status_current": null,
    "statusdate": null,
    "expiresdate": null,
    "remodel_repair_sqft": null,
    "number_of_floors": null,
    "housing_units": null,
    "original_address_1": null,
    "original_city": null,
    "original_state": null,
    "original_zip": null,
    "council_district": null,
    "jurisdiction": null,
    "project_id": null,
    "masterpermitnum": null,
    "latitude": null,
    "longitude": null,
    "contractor_trade": null,
    "contractor_company_name": null,
    "contractor_full_name": null,
    "contractor_phone": null,
    "contractor_address_2": null,
    "contractor_city": null,
    "contractor_zip": null,
    "certificate_of_occupancy": null,
    "legal_description": null,
    "applieddate_new": null,
    "issue_date_new": null,
    "statusdate_new": null,
    "expiresdate_new": null,
    "contractor_address_1": null,
    "project_name": null,
    "completed_date": null,
    "total_existing_bldg_sqft": null,
    "total_new_add_sqft": null,
    "link": null,
    "completed_date_new": null,
    "applieddate_new_new": null
  },
  {
    "id": 1,
    "permittype": null,
    "permit_type_desc": null,
    "permit_number": null,
    "permit_class_mapped": null,
    "permit_class": null,
    "work_class": null,
    "condominium": null,
    "permit_location": null,
    "description": null,
    "tcad_id": null,
    "applieddate": null,
    "issue_date": null,
    "day_issued": null,
    "calendar_year_issued": null,
    "fiscal_year_issued": null,
    "issued_in_last_30_days": null,
    "issue_method": null,
    "status_current": null,
    "statusdate": null,
    "expiresdate": null,
    "remodel_repair_sqft": null,
    "number_of_floors": null,
    "housing_units": null,
    "original_address_1": null,
    "original_city": null,
    "original_state": null,
    "original_zip": null,
    "council_district": null,
    "jurisdiction": null,
    "project_id": null,
    "masterpermitnum": null,
    "latitude": null,
    "longitude": null,
    "contractor_trade": null,
    "contractor_company_name": null,
    "contractor_full_name": null,
    "contractor_phone": null,
    "contractor_address_2": null,
    "contractor_city": null,
    "contractor_zip": null,
    "certificate_of_occupancy": null,
    "legal_description": null,
    "applieddate_new": null,
    "issue_date_new": null,
    "statusdate_new": null,
    "expiresdate_new": null,
    "contractor_address_1": null,
    "project_name": null,
    "completed_date": null,
    "total_existing_bldg_sqft": null,
    "total_new_add_sqft": null,
    "link": null,
    "completed_date_new": null,
    "applieddate_new_new": null
  },
  {
    "id": 0,
    "permittype": null,
    "permit_type_desc": null,
    "permit_number": null,
    "permit_class_mapped": null,
    "permit_class": null,
    "work_class": null,
    "condominium": null,
    "permit_location": null,
    "description": null,
    "tcad_id": null,
    "applieddate": null,
    "issue_date": null,
    "day_issued": null,
    "calendar_year_issued": null,
    "fiscal_year_issued": null,
    "issued_in_last_30_days": null,
    "issue_method": null,
    "status_current": null,
    "statusdate": null,
    "expiresdate": null,
    "remodel_repair_sqft": null,
    "number_of_floors": null,
    "housing_units": null,
    "original_address_1": null,
    "original_city": null,
    "original_state": null,
    "original_zip": null,
    "council_district": null,
    "jurisdiction": null,
    "project_id": null,
    "masterpermitnum": null,
    "latitude": null,
    "longitude": null,
    "contractor_trade": null,
    "contractor_company_name": null,
    "contractor_full_name": null,
    "contractor_phone": null,
    "contractor_address_2": null,
    "contractor_city": null,
    "contractor_zip": null,
    "certificate_of_occupancy": null,
    "legal_description": null,
    "applieddate_new": null,
    "issue_date_new": null,
    "statusdate_new": null,
    "expiresdate_new": null,
    "contractor_address_1": null,
    "project_name": null,
    "completed_date": null,
    "total_existing_bldg_sqft": null,
    "total_new_add_sqft": null,
    "link": null,
    "completed_date_new": null,
    "applieddate_new_new": null
  }
]

The IF condition is false if the ID field returns 1 because I have set the condition to IF {{ $json.id }} larger than 0

Hi @YogiYang :wave: When I ran using your example data, the workflow processed the true branch, and then processed the false branch after the wait. Is your true branch never completing? :thinking:

Can you try this workaround as well?

1 Like

Where should I add this Merge node? After Wait or before Wait?

I’d try it after the IF, before the Wait :+1:

I hope this is correct?

That does indeed look like what I would have suggested - is this working for you?

After using Merge node it is working like a charm.

Thank you for building such a easy to learn and use but still very powerful tool.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.