Skip to main content
shukurs2366
Known Participant
Jun 15, 2023 7:31 AM UTC
Question

Convert Dict to Map

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

Inspiring
Jun 15, 2023 7:50 AM UTC

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

harshitb6843
Brainy
Jun 15, 2023 7:55 AM UTC

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

stefanhelzle0001
Brainy
Jun 15, 2023 7:57 AM UTC

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

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

mathieud0001
Genius
Jun 15, 2023 9:59 PM UTC

To each their own :)

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

sanchitg0002
Inspiring
Jun 15, 2023 8:02 AM UTC

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
Jun 15, 2023 4:48 PM UTC

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.