2 Replies Latest reply: Feb 25, 2010 5:36 PM by QuestionsQuestions RSS

    Struggling with IF statement in LOAD

      A schoolboy error i'm sure, but i've checked the syntax and am now well and truly stuck

      I'm using an IF statement to load one value for a field if the field is NULL, and another if it is populated. I get an error though saying

      Error in expression:
      ')' expected

      Can anyone advise - thanks?

      Here's the code.

      Extras:

      LOAD Chg_ID,
      Chg_Desc,
      Chg_Just,
      ([creator_last_name] & ', ' & [creator_first_name]) as CreatorFullName,
      ([req_last_name] & ', ' & [req_first_name]) as ReqFullName,
      IF(ISNULL([owner_last_name]), [owner_last_name] as OwnerFullName ,([owner_last_name] & ', ' & [owner_first_name]) as OwnerFullName]),
      ([assignee_last_name] & ', ' & [assignee_first_name]) as AssigneeFullName;

      SQL SELECT a.id as Chg_ID,a.description as Chg_Desc, a.justification as Chg_Just, b.last_name as creator_last_name,
      b.first_name as creator_first_name, c.last_name as req_last_name,
      c.first_name as req_first_name, d.last_name as owner_last_name,
      d.first_name as owner_first_name, e.last_name as assignee_last_name,
      e.first_name as assignee_first_name

      FROM
      chg a,
      ca_contact b,
      ca_contact c,
      ca_contact d,
      ca_contact e

      where

      a.log_agent *= b.contact_uuid
      AND
      a.requestor *= c.contact_uuid
      AND
      a.z_rfc_owner *=d.contact_uuid
      AND
      a.assignee *=e.contact_uuid;