Array of documents in constant

I would like to create a constant LIST_OF_CATEGORY_AVATARS which will contain all the images (at least their IDs) from my images folder.

This is the case with my excercise interface:

The wanted result is: if I select developer category, automatically show me the developer category avatar below. If I select Analyst category, automatically show me the analyst category avatar below etc.

I believe I need to do these things:

- create constant that will represent content of my images folder (even though it looks to me that this cannot be done by with constant as content of that folder will change at some point)

- create expression rule on image component that will calculate which image to show depending on category rule input

What is the best way to create this connection between categories and images? Do I need the constant at all and does it have to be defined in a manner that I explicitly write down all the image document IDs in it?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    A few followup questions occur to me, before discussing best ways to handle this.

    1. What exactly is your need to store the document references (ids, etc) within a constant, specifically?
    2. Does this constant really have to reflect *all* documents in a folder?  How does the particular folder come into play here? 
    3. How many images will the total list likely be?  Just a handful, or hundreds, or something in between?
    4. From where exactly will you derive the list of text labels used in the "category" dropdown?  Is the expectation that this will be stored like in a separate constant, or something else?
  • I'll try to explain my idea as good as I can (I'm fresh to Appian, so i probably won't be aiming for the best practice :) ).

    I will have only handful of categories (these categories are just example, I would like to find the best practice for these "image from one component depends on text value from the other component" when it comes to less then 10 or 15 different values).

    I believe that writing of the mapping rules "image for value" can't be avoided (or at least I can't see better practice at the moment).

    So, when I have to modify expressions to map image on category, I would like to at least avoid manual addition of new images to the constant array if I can.

    Let's say I have folder with 4 images at the moment (I believe array of image UUIDs would be the best choice because IDs may vary through the environments?) and expression for mapping these 4 images to 4 corresponding categories.

    At some point I add 3 new images to the folder for category avatars.

    Is there a way to write that constant so it can dynamically switch from 4 elements array to 7 elements array and then the only thing that remains for me is to define new rules for 3 new categories/images? Or I have to add 3 new image UUIDs manually to the array before that step?

Reply
  • I'll try to explain my idea as good as I can (I'm fresh to Appian, so i probably won't be aiming for the best practice :) ).

    I will have only handful of categories (these categories are just example, I would like to find the best practice for these "image from one component depends on text value from the other component" when it comes to less then 10 or 15 different values).

    I believe that writing of the mapping rules "image for value" can't be avoided (or at least I can't see better practice at the moment).

    So, when I have to modify expressions to map image on category, I would like to at least avoid manual addition of new images to the constant array if I can.

    Let's say I have folder with 4 images at the moment (I believe array of image UUIDs would be the best choice because IDs may vary through the environments?) and expression for mapping these 4 images to 4 corresponding categories.

    At some point I add 3 new images to the folder for category avatars.

    Is there a way to write that constant so it can dynamically switch from 4 elements array to 7 elements array and then the only thing that remains for me is to define new rules for 3 new categories/images? Or I have to add 3 new image UUIDs manually to the array before that step?

Children