How to make numbered list from array. (for the perplexity citations)

CleanShot 20241209_004348

Perplexity returns citations as array.

I want to make a text like:
“”"
[1] citation 1
[2] citation 2
“”"

I want to know how to add “[i]” in front of citation url and add newline for the next citation.

1 Like

Hello @Tagg_Lee and welcome to the Make Community!

I think you can use an Iterator on the citations array followed by a Text Aggregator.
Iterator has a built-in variable indicating which position each element is in and you can use that in the text aggregator.
In Text Aggregator look at Advanced Options to separate each item by a New Row.

1 Like

Hi, thanks for the advice.

A had tried Text Aggregator, But didn’t found how to add a numbered list like "[1] ", "[2] " in front of the each array’s value.

1 Like

When you use an Iterator, it automatically adds two variables to each bundle, bundle order position and total number of bundles. You can use bundle order position to number your items in the aggregator.

1 Like

Thanks for keep watching.

I understand using Iterator and Text Aggregator.

But i think i found a error in my case.
In the right part of the image is Text Aggregator Module. The ‘value’ of Iterator module should appear, but it doesn’t.

1 Like

Seems like a display bug.
You could save your scenario, refresh the page, disconnect the Iterator and aggregator, run the scenario once, then re-connect the Iterator and Aggregator and see if the data shows up correctly.

1 Like

I tried it and create a new scenario but not works.

Here is more details of settings. Is there any problem?

1 Like

Array used from your sample:

iterate through the array:

Set up the text aggregator as follows:

Sample workflow and output:

Best regards,

Msquare Automation
Platinum Partner of Make
@Msquare_Automation

1 Like

Thank you for your kind guidance.

Using the same method, I was able to make it work as well. However, when the module fetching the Array is Perplexity, I cannot select the value of the Iterator in the Aggregator.

Could this be considered a system issue?

1 Like

Hi @Tagg_Lee

If you can share the output bundle of perplexity module we can further assist you.

Best regards,

Msquare Automation
Platinum Partner of Make
@Msquare_Automation

Hi @Tagg_Lee

Unlink the workflow after the iterator and run the scenario. Check which variable retrieves the values from the iterator. By running the iterator once, you’ll be able to map the value.

Best regards,
Msquare Automation
Platinum Partner of Make
@Msquare_Automation

Here is the output bundle of perplexity.

[
    {
        "id": "6e6e4fda-ee16-4b9c-9453-4061c28fc77e",
        "model": "llama-3.1-sonar-large-128k-online",
        "created": 1735563622,
        "usage": {
            "prompt_tokens": 217,
            "completion_tokens": 802,
            "total_tokens": 1019
        },
        "citations": [
            "https://ko.wikipedia.org/wiki/%EB%AF%B8%EC%99%84%EC%84%B1_%ED%9A%A8%EA%B3%BC",
            "https://healingdoctor.org/entry/%EC%9E%90%EC%9D%B4%EA%B0%80%EB%A5%B4%EB%8B%89-%ED%9A%A8%EA%B3%BCZeigarnik-Effect-%EB%AF%B8%EC%99%84%EB%A3%8C%EB%90%9C-%EC%9D%BC%EC%9D%B4-%EB%87%8C%EC%97%90-%EB%AF%B8%EC%B9%98%EB%8A%94-%EC%98%81%ED%96%A5%EA%B3%BC-%EC%82%AC%EB%9E%91%EC%9D%98-%EA%B0%90%EC%A0%95%EA%B3%BC%EC%9D%98-%EA%B4%80%EA%B3%84",
            "https://www.samsungsds.com/kr/insights/1233605_4627.html",
            "https://001g.tistory.com/entry/%EC%9E%90%EC%9D%B4%EA%B0%80%EB%A5%B4%EB%8B%89-%ED%9A%A8%EA%B3%BC-%EB%AF%B8%EC%99%84%EC%84%B1%EC%97%90-%EB%AF%B8%EB%A0%A8%EC%9D%B4-%EB%82%A8%EB%8A%94%EB%8B%A4",
            "https://brunch.co.kr/@9e4090557c4c420/28"
        ],
        "object": "chat.completion",
        "choices": [
            {
                "index": 0,
                "finish_reason": "stop",
                "message": {
                    "role": "assistant",
                    "content": "Content is too long and i remove it."
                },
                "delta": {
                    "role": "assistant",
                    "content": ""
                }
            }
        ]
    }
]
1 Like

I already tried but not works :cry:

1 Like

Hello @Tagg_Lee.

The issue with not showing the values of the iterator when you try to map them is only visual. If you run this it will show show the correct result.


If the “value” is not displayed to select it, try to write it directly instead. Could be a visual bug.
So for my example it would be “[{{13.__IMTINDEX__}}] - {{13.value}}”.

Since the data are being passed into the iterator and you can see them there, I do not see a reason why the perplexity module would be at fault here.

3 Likes

Hi @Tagg_Lee

Copy paste the following variable in place of value from iterator:

{{46.value}}

Based on your screenshots, it looks like the iterator is the 46th module. If it’s not, adjust the number accordingly and then copy and paste the variable.

Best regards,

Msquare Automation
Platinum Partner of Make
@Msquare_Automation

1 Like

It works!

Thank you so much for your help! I truly appreciate the time and effort you took to assist me with this issue :slight_smile:

@Msquare_Automation @Foivos @Donald_Mitchell

2 Likes