Skip to main content
Inspiring
January 30, 2021
Question

Could not cast from Text to AB_location

  • January 30, 2021
  • 1 reply
  • 0 views

local!vehicleBaseLocations: append(local!vehicle,"ALL"),

I have written a rule and called that in local!vehicle(i am fetching data from DB). Am calling that in local!vehicleBaseLocations,I need to add ALL option also, I have used append to achieve it but its throwing error "  Could not cast from Text to AB_location. Details: CastInvalidCould not cast from Text to AB_location. Details: CastInvalid 

Can someone help what exactly am missing

    1 reply

    csteward
    Brainy
    January 30, 2021

    Your use of append() will need to be adjusted here - what you are attempting to do above is append the text "ALL" into your AB_location CDT which has a different type, generating the mismatch error.  You will want to append a line of type AB_location which includes the "ALL" value, such as:

    a!localVariables(
      local!vehicle: 'type!{urn:com:appian:types}chris_test_cdt'(
        id: 1,
        data: "item1"
      ),
      
      append(
        local!vehicle,
        'type!{urn:com:appian:types}chris_test_cdt'(
          id: null,
          data: "ALL"
        )
      )
    )