Split not working

Negjat Jusaj November 19, 2024

 

Hello community,

I am trying to map the following use case in an automation, unfortunately without success: I want to "increment" the current value of the Angenummer attribute in asset management, in the first step I try to divide the string Angenummer (2024/1), unfortunately that doesn't work for me (I don't get a result): I have already tried the following functions:

{{lookupObjects.first.Angenummer}} = Angenummer is displayed {{lookupObjects.first.Angenummer.split("/").1.asNumber}} = No result {{lookupObjects.first.Angenummer.split("/").1}} = No result {{lookupObjects.first.Angenummer.split("/")}} = No result Test {{lookupObjects.first.Angenummer.trim().split("/").1}} = No result Result

I've already tried substring - unfortunately without result.... Does anyone have an idea why this doesn't work?

3 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2024

Hi @Negjat Jusaj 

You state you have tried several things, yet the community cannot observe those to compare what you believe happened to what the rule execution shows...

 

For a question like this, context is important for the community to help.  Please post the following:

  • an image of your complete automation rule in one single image file
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution

 

Kind regards,
Bill

0 votes
Salih Tuç
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2024

Hi @Negjat Jusaj ,

".1" is not a valid getter for the list type in smart values. You can use following to access the elements:

  • first -> To access first element (Element at 0, first part of the split)
  • last -> To access the last element
  • get(i) -> To access the ith element

 

So, just change your smart values as {{lookupObjects.first.Angenummer.split("/").get(1)}} in order to get "1" from "2024/1"

Negjat Jusaj November 19, 2024

Hi,

thanks for your contribution, unfortunately I still don't get any results

Salih Tuç
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2024

Ok, then new idea:

  • Create an attribute -> angenummer => {{lookupObjects.first.Angenummer.toString()}}
  • Log that value
  • Run the split on this new attribute -> {{angenummer.split("/").get(1)}}
  • Log that value

And then, can you share the logs if this doesn't work?

Negjat Jusaj November 19, 2024

Hi Salih,

thanks for your help. I'm already running the logging, the problem is that I'm not getting any errors with the smart values ​​used, but simply no results are being output.

0 votes
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2024

Hi @Negjat Jusaj 

 

As I remember split() is working on strings. I'm not sure that your script knows that you are working on string.

Please try to add toString() before split()

 

Also what is see is you are using LookupObjects which is array so definatelly your split() is trying to work on array, not string.

 

Regards,

Seba

Salih Tuç
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2024

Hi @Sebastian Krzewiński , the value is "2024/1", so it is probably a string at first place :) I think this is related with ".1" at the end.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events