Using INLIST()

INLIST() can be used in Calculated Fields and Filters to test for a number of values in one expression. INLIST() will produce a .T. or .F. answer.

  • This expression test how long a contact has been registered, 155 days, 515 days etc.:
    INLIST(contact1.startdate,  DATE()-155, DATE()-515, DATE()-880, DATE()-1245, DATE()-1610, DATE()-1975)
  • Sales Rep Territory Assignment. By stringing the IIF() statements together you will have a pretty good:
    if … then … else …
    iif(inlist(upper(contact1.stat),”AZ”,”CO”,”DE”,”MN”,”MO”,”ID”,”CN”), “TST”,iif(inlist(etc…))
  • This is a calculation for the REGION field. It automatically assigns 3 territories: East, Canada, and International.
    iif(inlist(upper(contact1.sta), ‘PR’, ‘VI’, ‘MA’, ‘RI’, ‘NH’, ‘ME’, ‘VT’, ‘CT’, ‘NJ’, ‘PA’, ‘NY’, ‘DE’, ‘DC’, ‘MD’, ‘VA’, ‘WV’, ‘NC’, ‘SC’, ‘GA’, ‘FL’, ‘OH’), “East”, iif(inlist(upper(contact1.sta), ‘AL’, ‘TN’, ‘MS’, ‘KY’, ‘IN’, ‘MI’, ‘IA’, ‘WI’, ‘MN’, ‘SD’, ‘ND’, ‘IL’, ‘MO’, ‘KS’, ‘NE’, ‘LA’ “CANADA”, “International”, iif(upper(contact1.country) = “CANADA”, “Canada”,””)))))
  • This expression would do two things. Calculate the level two EXPENSES and only do it for certain types (Ads, Travel). Example calculated expression for level 1 field:
    ChildSum(‘contact2.expenses’,’inlist(upper(contact2.jobtype),”ADS”, “TRAVEL”)’)
  • Here’s an IIF() expression with INLIST() testing on different zip codes:
    iif(inlist(contact1.zip, ‘91831’, ‘91832’, ‘91880’, ‘91881’, ‘90025’), ‘DMP’, ‘CAP’)
  • This would return a D if the zip code was between 10000 and 20000, and an M otherwise:
    iif(between(left(contact1.zipcode,5),’10000′,’20000′),”D’,’M’)