Skip to main content
marcusm0003
Inspiring
Feb 17, 2023 8:03 AM UTC
Solved

Unable to update a single value in a list with a!update

I researched and checked theres known issues for a!update so I was hoping that someone may have solutions for this particular scenario.
The output for the following code just returns a 4 instead of 4 Current

a!update(
      remove(
        {1,2,3,4,5,6,7},
        remove(
          enumerate(0,1,2,3),
          1
        )
      ),
      1,
      ri!application.projectYears & " Current"
)

marcusm0003
Inspiring
Feb 20, 2023 1:28 AM UTC

The requirement is to display a dropdownlist from currentProjectYears and above up to 7 thus 4, 5, 6, 7. Parameters wise shouldnt have an issue. 

a!update(
      touniformstring(
        remove(
          {1, 2, 3, 4, 5, 6, 7},
          remove(
            enumerate(ri!application.projectYears), // this is 0,1,2,3
            1
          )
        )
      ),
      1,
      ri!application.projectYears & " (Current)" // to display (current) for 4th year which is current project years
    )

4 replies

stefanhelzle0001
Brainy
Feb 17, 2023 9:21 AM UTC

I do not understand what this code should do, and I get error messages about a wrong number of parameters for the enumerate function(). Maybe you want to explain in more details what you want to achieve.

marcusm0003
marcusm0003AuthorAnswer
Inspiring
Feb 20, 2023 1:28 AM UTC

The requirement is to display a dropdownlist from currentProjectYears and above up to 7 thus 4, 5, 6, 7. Parameters wise shouldnt have an issue. 

a!update(
      touniformstring(
        remove(
          {1, 2, 3, 4, 5, 6, 7},
          remove(
            enumerate(ri!application.projectYears), // this is 0,1,2,3
            1
          )
        )
      ),
      1,
      ri!application.projectYears & " (Current)" // to display (current) for 4th year which is current project years
    )

achutaharshavardhanv6069
Known Participant
Feb 20, 2023 12:49 AM UTC

2 things what i understood is if you are trying to achieve to remove the first 3 indexes and update the value 4&current into the 4th index. Here is the code 

and it will update as 4 not 4& current as the values are all in number integer data type. i tried passing only current instead of 4&current it gave me as null in that index. So try it like this else (shown in the screeshot)

a!update(
  remove(
    {1,2,3,4,5,6,7},
  enumerate(3)+1
  ),
  1,
 4 & " Current"
)

marcusm0003
Inspiring
Feb 20, 2023 1:23 AM UTC

Hi found a fix w my teammate - adding touniformstring will enable this to work