I am trying to create a rule that lets me copy an IP address from one field to another, but inserting zeroes in order to make it sortable.
i.e.
IP_Field1 == 192.168.0.10
desired outcome:
IP_Field2 == 192.168.000.010
My thought was to use a combination of split() and leftpad() to accomplish this. Please note, I am not a developer and I am attempting to do this just be RTFM-ing the instructions found here: https://codebarrel.atlassian.net/wiki/spaces/AUTO4J/pages/51691794/Working+with+Strings
The instructions show how to access the "first" value in the split, but I am not able to figure how to get the 2nd, 3rd, and 4th octets.
Any suggestions?
Hello,
Could you try
{{issue.reporter.IP_Field1.split(" .")[1]}}
for the second octet.
Though I did not check it.
Hi Alexey, thanks for responding. Unfortunately that did not work.
This works:
{{issue.reporter.IP_Field1.split(".").first}}
Which is same as example in documentation and produces: 192
This also works:
{{issue.reporter.IP_Field1.split(".")}}
and produces: 192, 168, 0, 10
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Iohan,
I am curious to learn if you found a solution to extract other octets than the first. I have the same problem and I can extract the first octet or get a list of all.
Thanks for your reply
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has anyone be able to resolve this? I am only able to get the first octet in then split string as well. So for example, I am splitting on "_":
ACH 1.0_QA_testuat_ex_debit 1.0
and I need to set each as a smart value.
issue.summary.split("_")[4] <-- this did not work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @MCrawford -- Welcome to the Atlassian community!
Please try the following: {{issue.summary.split("_").get(4)}}
The documentation is a bit incomplete; look here for more info: https://community.atlassian.com/t5/Jira-Software-questions/JIRA-automation-and-a-working-example-of-the-Split-function-for/qaq-p/1395718
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.