How to concatenate multiple variables, not just two
![Carlos](https://us.v-cdn.net/6037124/uploads/userpics/P8CEOAI3SFPD/nL13Q96FNH3X2.jpg)
Hi,
so my external API function has an input of up to 4 variables that I need to combine into a single param for my API call.
I've been looking around, found "concat" but it seems designed to concatenate only two values.
Here's the specific issue, see the following API call:
https://api.twitter.com/2/tweets/search/recent?query=indie lang:es place_country=ES -is:retweet&tweet.fields=public_metrics,text,author_id,entities,context_annotations&expansions=author_id&place.fields=id,full_name,country,country_code,place_type&user.fields=id
Param query
is constructed with multiple inputs, topic
, lang
, place_country
… separated by a whitespace
I have a variable query
where I need to concatenate those inputs separated by a whitespace to pass into the API call.
I guess I could go by steps:
concatenate topic+lang, then concatenate topiclang+place… and so on.
Is it there a better way to do this?
Best Answer
-
Hey @Carlos chaining your concat filters is a great way to do this! I see nothing wrong with this approach. Another filter you could consider for this is sprintf, it might look a little cleaner to the eye. You might consider building the parameter in a variable first too so your external API request function doesn't use as much vertical real-estate.
Answers
-
Thanks @Michael Udinski, yes I went for chainning the concats, not as bad as I thought, just getting my head around Xano's way
-
Awesome!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback