Rearranging arrays

Iterator output currently look like this with 5 output bundles

Screenshot 2024-01-12 at 9.34.30 AM

What operations do I need to rearrange the arrays so they are grouped by categories such as SKU, Name, Phone, Address, etc?

I need to subsequently create a google sheet so that all the extracted parameters are pasted into one file, which it is currently not doing (its giving me 5 separate files).

This is clearly NOT an array, you are using the iterator incorrectly.

Every result (item/record) from a search module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module.

If you need further assistance,

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

3 Likes

I went the json route to get the output into a bundle of 9 arrays

Next I need to write this information onto a newly created google sheet

So far I can only get the first value in each array to populate the sheet. I am guessing I need some json instructions here.

At this point I am basically going about it based on trial and error as I have zero knowledge on json. I know I should have gone through the foundations and understand the whole framework from a logical aspect, but unfortunately I just do not have the time at the moment.

I hope the information I provided makes sense. If not please let me know what is needed to clarify what I am trying to do. Sorry for going about it in such a crude way and thank you for your patience.

blueprint.json (53.0 KB)

Hey There @Caine_Wai ,
Try Using this Scenario


and inside the "create the spreadsheet " module , map the following

Let me know if this helps.

3 Likes

Hi ishan, thanks for your help!

I followed your method and got this output


I am starting to think I am punching a bit too much above my weight lol
blueprint (2).json (38.4 KB)

can you share the output bundle from the array aggregator

2 Likes

Get starts from index 1 - you used a 0 in the first field.

2 Likes


Changed to starting from 1 instead of 0

[
    {
        "kind": "drive#file",
        "id": "1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs",
        "name": "Sample Order - Kitchen Products2024-01-12T09:59:43.060Z",
        "mimeType": "application/vnd.google-apps.spreadsheet",
        "starred": false,
        "trashed": false,
        "explicitlyTrashed": false,
        "parents": [
            "1-Gu-Qu8QAiP7R9hYKUUgAummOC_OnrTd"
        ],
        "spaces": [
            "drive"
        ],
        "version": "5",
        "webViewLink": "https://docs.google.com/spreadsheets/d/1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs/edit?usp=drivesdk",
        "iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.spreadsheet",
        "hasThumbnail": true,
        "thumbnailLink": "https://lh3.googleusercontent.com/drive-storage/ANtge_GaNTemvBHDWSCA6htDwDyJb8XmJOnMuq_9l74zEsFFlwYxR17ZNxfoaBb4atgye04V_46t_VWXYsYKn-Ebog9do62D8X4-cF2Jo2F2iL3yYbHoMidJBtk=s220",
        "thumbnailVersion": "1",
        "viewedByMe": true,
        "viewedByMeTime": "2024-01-12T04:55:03.770Z",
        "createdTime": "2024-01-12T09:59:43.117Z",
        "modifiedTime": "2024-01-12T09:59:43.117Z",
        "modifiedByMeTime": "2024-01-12T09:59:43.117Z",
        "modifiedByMe": true,
        "owners": [
            {
                "kind": "drive#user",
                "displayName": "Caine Wai",
                "photoLink": "https://lh3.googleusercontent.com/a/ACg8ocKuCr9weOsoZNQEpJ__gdQOTk65xt3IE4R0k5qS-gd3=s64",
                "me": true,
                "permissionId": "12459289486432848484",
                "emailAddress": "cevatech.hk@gmail.com"
            }
        ],
        "lastModifyingUser": {
            "kind": "drive#user",
            "displayName": "Caine Wai",
            "photoLink": "https://lh3.googleusercontent.com/a/ACg8ocKuCr9weOsoZNQEpJ__gdQOTk65xt3IE4R0k5qS-gd3=s64",
            "me": true,
            "permissionId": "12459289486432848484",
            "emailAddress": "cevatech.hk@gmail.com"
        },
        "shared": false,
        "ownedByMe": true,
        "capabilities": {
            "canAcceptOwnership": false,
            "canAddChildren": false,
            "canAddMyDriveParent": false,
            "canChangeCopyRequiresWriterPermission": true,
            "canChangeSecurityUpdateEnabled": false,
            "canChangeViewersCanCopyContent": true,
            "canComment": true,
            "canCopy": true,
            "canDelete": true,
            "canDownload": true,
            "canEdit": true,
            "canListChildren": false,
            "canModifyContent": true,
            "canModifyContentRestriction": true,
            "canModifyEditorContentRestriction": true,
            "canModifyOwnerContentRestriction": true,
            "canModifyLabels": false,
            "canMoveChildrenWithinDrive": false,
            "canMoveItemIntoTeamDrive": true,
            "canMoveItemOutOfDrive": true,
            "canMoveItemWithinDrive": true,
            "canReadLabels": false,
            "canReadRevisions": true,
            "canRemoveChildren": false,
            "canRemoveContentRestriction": false,
            "canRemoveMyDriveParent": true,
            "canRename": true,
            "canShare": true,
            "canTrash": true,
            "canUntrash": true
        },
        "viewersCanCopyContent": true,
        "copyRequiresWriterPermission": false,
        "writersCanShare": true,
        "permissions": [
            {
                "kind": "drive#permission",
                "id": "12459289486432848484",
                "type": "user",
                "emailAddress": "cevatech.hk@gmail.com",
                "role": "owner",
                "displayName": "Caine Wai",
                "photoLink": "https://lh3.googleusercontent.com/a/ACg8ocKuCr9weOsoZNQEpJ__gdQOTk65xt3IE4R0k5qS-gd3=s64",
                "deleted": false,
                "pendingOwner": false
            }
        ],
        "permissionIds": [
            "12459289486432848484"
        ],
        "size": "1024",
        "quotaBytesUsed": "1024",
        "isAppAuthorized": true,
        "exportLinks": {
            "application/x-vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=ods",
            "text/tab-separated-values": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=tsv",
            "application/pdf": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=pdf",
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=xlsx",
            "text/csv": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=csv",
            "application/zip": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=zip",
            "application/vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=1v2uyES_z-Bt4tPIHGANOKwiUaLqwv41c_i630vQliLs&exportFormat=ods"
        },
        "linkShareMetadata": {
            "securityUpdateEligible": false,
            "securityUpdateEnabled": true
        }
    }
]

Hey @Caine_Wai ,
You provided the output bundle of the Google Sheet Module , can You please provide the output bundle of the Array Aggregator Module.

2 Likes
[
    {
        "array": [
            {
                "2": "Cortney Hart",
                "6": "AA200-BU_8",
                "10": "9434611206217300920853",
                "11": "18128216412",
                "12": "2394 Dunn road ",
                "13": "",
                "14": "Freedom ",
                "15": "Indiana",
                "16": "47431"
            },
            {
                "2": "Quesha smith ",
                "6": "AA384-BU_8",
                "10": "9434611206217300918607",
                "11": "17026599585",
                "12": "9265 west Russell road A455",
                "13": "",
                "14": "Las Vegas",
                "15": "Nevada",
                "16": "89148"
            },
            {
                "2": "Tara Stelz",
                "6": "AA200-BU_8",
                "10": "9434611206217306001556",
                "11": "14842211368",
                "12": "315 East Stone Alley",
                "13": "",
                "14": "Alburtis",
                "15": "Pennsylvania",
                "16": "18011"
            },
            {
                "2": "Davey Struggle",
                "6": "AA200-BU_8",
                "10": "9434611206217306841831",
                "11": "19718324601",
                "12": "4505 Yellow Creek Pl",
                "13": "",
                "14": "Caldwell",
                "15": "Idaho",
                "16": "83607"
            },
            {
                "2": "Sarah Van Reeth",
                "6": "AA384-BU_8",
                "10": "",
                "11": "12159338077",
                "12": "54 Hempstead Rd",
                "13": "",
                "14": "Hamilton",
                "15": "New Jersey",
                "16": "8610"
            },
            {
                "2": "RAENISHA Washington",
                "6": "AA384-BU_8",
                "10": "",
                "11": "15735902708",
                "12": "1321 s Roseta ave ",
                "13": "",
                "14": "Columbia ",
                "15": "Missouri",
                "16": "65201"
            }
        ],
        "__IMTAGGLENGTH__": 6
    }
]

Hi @Caine_Wai

Method 1: You need to create the template before the module you are mapping the data from in the iterator.

  1. create the spreadsheet from template
  2. get the data using your designated module
  3. Use add a row module from google sheet.
    Map the spreadsheet ID from “create a spreadsheet using template” module.

It will cost operation for each added row.

Method 2: If you want to save the operations, you can use this approach :point_down:

Method 3: To save more operations, you can go with our Custom App:

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

Hi, thanks for the reply.

I have a template created already and it looks like this

I was trying to map the output of the array aggregator onto a new google sheet created from this template however I only got it to copy the same entry on all the rows.

What I need to learn is:

  1. How to map the values of each array (SKU, Name, Phone number, etc) sequentially down each column
  2. When it reaches the end of the array, it knows to fill the google sheet cells with blanks instead of leaving them as {{tag}}
  3. When I add the add row module, it knows to map to the new google sheet created each time I run the scenario, instead of a fixed file.

If you could point me in the right directions it would really help.

Hi @Caine_Wai

First you need to clear the values from your template. Only headers should be in the template not the values.

Then follow the steps we mentioned earlier. Here is the image for your reference going with method one. (replace the set variable module with the module you are getting the data from)

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

Thanks again for your reply.
I am still running into a few problems:

  1. With the template it says I need to have at least one tag in it. Thats why i assumed tags are for mapping the variables onto each column

Screenshot 2024-01-18 135029

  1. How do I map the file in add row module to the one that has been newly created each time I run this scenario?

  2. How do I tell the scenario to pick out which columns (fields) I would like to add in the add row module?