Support #3612

Request for help in working with data lists

Added by Vadim about 1 month ago. Updated 16 days ago.

Status:ClosedStart date:08/10/2020
Priority:NormalDue date:
Assignee:Vadim% Done:

0%

Category:-
Target version:RapidDeploy - 5.0-FIX
Affects Version:5.0-FIX Additional version details:
Timesheet Code:

Description

Hello.

Would like to ask for some help in configuring task workflow. Here is what I have to do:
I get an URL map in JSON format like this: {"url_map": [{"full_url": "long_url_path", "short_url": "short_url_path"}]}.
So that is a JSON object with an array inside. Array may contain any number of items. I need to proceed each item getting "long_url_path" and "short_url_path" values. Those values will be written to another file later.
So can You please assist me how to configure a proper loop over such data (as I understand loop is the only solution for array data)?

Thank You in advance!

Best regards,
Vadim.

ListManagementTest.zip (4.14 KB) Rafael, 08/12/2020 04:18 pm

History

#1 Updated by Rafael about 1 month ago

  • Status changed from New to In Progress
  • Assignee set to Rafael
  • Target version set to 5.0-FIX

Hi Vadim,

I think the best approach here is to use the "Match String Regex" task:

http://docs.midvision.com/LATEST/rapiddeploy-orchestration/resources/tasksMetaData.html#d1e3818

I'm not an expert in regular expressions but I think this could do what you are looking for.

I'll try to find a proper configuration for you and will keep you updated.

Cheers!

Rafa

#2 Updated by Vadim about 1 month ago

Hi Rafael.

Thank You for the reply. I do have small experience with RegEx, but just am not sure if such type of task can produce the result to loop on. Will it produce list of values? :) I'll try to test it.

Best regards,
Vadim.

#3 Updated by Rafael about 1 month ago

  • File ListManagementTest.zip added
  • Status changed from In Progress to Feedback
  • Assignee changed from Rafael to Vadim

Hi Vadim,

I prepared a small example project I created based on what I understood are your requirements, I hope it can help! :-)

Just download it and import it into your RapidDeploy server using the "Upload Project" button.

It's extremely simple and what it basically does is:

1) Read the JSON file into a string.
2) Using different regular expressions it gets in one output list the full URLs and in a different output list the short URLs with two different tasks.

This is the main point as it will depend on what you want to get from the file. I used these regular expressions:

"full_url": "(https?|ftp|file)://[-a-zA-Z0-9+&#/%?=~_|!:,.;]*[-a-zA-Z0-9+&#/%=~_|]

"short_url": "(https?|ftp|file)://[-a-zA-Z0-9+&#/%?=~_|!:,.;]*[-a-zA-Z0-9+&#/%=~_|]

That get the full URLs and the short URLs respectively.

I got it from this web site:

https://urlregex.com/

Where the claim to have "The Perfect URL Regular Expression"! :-)

3) You iterate over the full URLs:

3.1) Remove the prefix needed to get the URL with the regular expression.
3.2) Perform any action you want over the URL. In this case it's just an "Echo Message" task to show it. :-)

4) You iterate over the short URLs:

4.1) Remove the prefix needed to get the URL with the regular expression.
4.2) Perform any action you want over the URL. In this case it's just an "Echo Message" task to show it. :-)

Maybe this is not exactly what you need but I hope you can at least get a good idea and you find it useful! :-)

Cheers!

Rafa

#4 Updated by Rafael 26 days ago

  • Status changed from Feedback to Marked for Closure

Hi Vadim,

Was my information useful?

Please let me know if you need any further help with this.

Cheers!

Rafa

#5 Updated by Rafael 16 days ago

  • Status changed from Marked for Closure to Closed

Also available in: Atom PDF