'comparing attributes of 2 different turtles breed

I have 2 turtles bread:

globals [ max-applicant ]
breed [ applicants applicant ]
breed [ investors investor ]

applicants-own [ ask-amount applied? industry country-of-origin funded? ]
investors-own [ allowed-industries-list allowed-countries-list no-of-applicants-funded ]

I want to perform a transaction based on whether the investor is allowed to do business with the applicant's industry and country of origin. An Investors can only perform a limited number of transactions based on the max-applicant value

In the code below, I'm trying to select an investor that hasn't reached the max transaction limit and then select an applicant that meets the conditions of the selected investor and fund that applicant:

to close-deal
  let investorPerson one-of investors-here with [no-of-applicants-funded < max-applicant]
  if investorPerson != nobody  [
    ask investorPerson  [
      let applicantPerson one-of applicants-here with [
        industry member? [allowed-industries] and country-of-origin member? [allowed-countries] of myself
      ]
      if applicantPerson != nobody  [
        ask applicantPerson [
          set funded? TRUE
        ]
      ]
      set no-of-applicants-funded no-of-applicants-funded + 1
      
    ]
  ]
end

This code doesn't run. is this the right way to design this operation?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source