Skip to main content
shukurs2366
June 15, 2023
Question

Convert Dict to Map

  • June 15, 2023
  • 10 replies
  • 0 views

Interface is holding Dict Type
Process model is holding Map Type

Clash b/w the dataTypes while triggering PM.

Could you please help me to convert dict to map before triggering?

10 replies

June 15, 2023

you can use a!map() function docs.appian.com/.../fnc_system_map.html

harshitb6843
June 15, 2023

cast(
  typeof({a!map()}),
  {
    name: "Harshit",
    website: "harshitbumb.com",
    blog: "appianspace.com"
  }
)

stefanhelzle0001
June 15, 2023

I try to avoid using typeof and reference the type directly.

cast(
  type!Map,
  {
    name: "Harshit",
    website: "harshitbumb.com",
    blog: "appianspace.com"
  }
)

mathieud0001
June 15, 2023

To each their own :)

I personally find typeof more predictiable than using direct types because of the auto-complete which is hit and miss

June 15, 2023

Interface or Expression rule?

You can use the cast() function to cast into Map but AFAIK there is no need for it, as dictionary gets casted into Map automatically, if your output is of type List of dictionary then make sure that Map type pv! is Multiple selected.

peter.lewis
Employee
June 15, 2023

Just curious, why are you using a dictionary? Maps are essentially better than a dictionary in every way, so it's usually better to define your data using a map instead. If you're receiving the data from an integration or something, you can also use the options that others suggested to cast to a map.