Questions about Filter Data Transformation in Server Connect

Teodor, another great update. I can indeed see some use cases I’ll be able to use these for.

Question.

External API data source
Internal dB query that must match the external data source API’s UID.

I looked at the formatter for this but appears I’ll still just need to use the normal repeat function for a workflow like the above?

I am not sure i understand your question here?

Fair enough. Considering the use case - do I understand the formatter function well enough that it won’t work in that scenario?

The filtering will be very useful fir me by the way.

What is the scenario? What are you trying to do? Which of the 4 options are you referring to?

Scenario is in my post and the option I’m referring to is join.

Current Scenario is:
External API returns multiple records each with a UID
I repeat this
Inside repeat I do an internal query on a new table for all records matching the source API’s UID.
I then select the repeat for the combined data for output on the front end

I was simply posing the question if I’m missing something with join or for my case I need to leave as is. It’s working fine - just thought join might be more efficient.

@Teodor following up on this - wondering if it might be possible to use the filter transform with a condition at some point in the near future?

E.g. crude use case:

API External Data Source
Use Filter Columns in Data Transformations
Show all 10 values from the API IF user_type = admin
Otherwise only show 5 chosen values

Essentially showing/hiding columns using the filter column based on a condition perhaps from a previous DB Query. Do you see this being feasible with this module, if so, i’ll put as a feature request.

Well why not add a condition step with two different filter steps with the same names inside it (then/else)?

This wouldn’t really work without a repeat, would it?

The API returns say 10 records. As I understand it I could use Data Transformations on that API Data without repeating, to choose columns/filter columns etc. if I use the current condition, I then need to repeat the API Data and then implement your suggestion?

Question - if I use a condition, and as you suggest have an output with the same name - then when I use a data picker on that data, will it be seen as one collection of data? I didn’t realize it would work that way if both outputs for a then/else condition are named the same. If that is in fact the case then i will run a test on this to see what it performs like.

Why would you need a repeat for?
Just condition > query.value == 1
then > filter step1
else > filter step2

Well, I’m optimistic I don’t based on your feedback! My understanding is that to run a condition on multiple records I need to repeat the records.

So, let me put it plain words (for my benefit!!)

I have an API. It returns 10 records. Each record has a UID.
I have an internal DB. This holds records that contain UID of the same format as the API.

Workflow:
Call API and get 10 records, with 10 UIDs.
Query DB > based on query I get 5 UIDs.

My previous understanding was to run a condition on each of the 10 API records then/else, such as does API Record 1 (UID=123) match Query DB 1 (UID=123) then/else.

So, are you saying

I can get 10 records (each with a UID) from the API
one Then/Else condition
then > filter step1
else > filter step2

Doesn’t seem right in my mind…

I don’t really understand what you are doing there.
Based on your reply:

Aren’t you checking the current logged user (or filter a db query) to see if he’s admin or not?

I’m asking if it’s possible to filter results using the new data transformation based on conditions that might apply differently for a number of records. So whether we call that field user_type = admin or UID = 1234 the principal i’m thinking on is the same, these are just two crude examples.

So, back to the idea.

If I have 10 records, you are suggesting I can check a condition in the record against an internal DB query (this could be user_type or UID), and then I only need one condition even though there are 10 records coming from the API?

And secondly, if I use a condition but name the filter columns the same - then the output I’ll see in the next step will be merged?

Screen Shot 2021-04-07 at 5.20.43 pm

Here’s a screen related to my thinking - but I’d prefer if I didn’t have to repeat, I just can’t see how it would work on each record without a repeat?

Also are you sure you understand what does filter do exactly?
It does not filter values, it selects which columns should be returned from the data source and which not …

Your data source returns all these columns:

You select to keep only these:

So the result is only these columns:

this option does NOT filter your data source by values!

Yep, I know that - and that’s exactly what I would need to happen.

My mistake on terminology.

I should have said instead of showing 10 or 5 values, it would show 10 or 5 columns. As the data source is JSON I wasn’t entirely sure calling it column was correct, but we are on the same page here.

Why use a repeat here, i really can’t get your logic …
Filter works like that - it gets the data from a data source and you select which columns to show.
It does not work in repeats like that - no repeat should be used.

Yep, I understand. I’m not using the repeat for the benefit of the filter I’m using it for the condition.

So, as I understand it - the only way I can do a then/else on the 10 records individually from the API is to repeat the API, so that the condition runs PER record. Then I use the filter per record.

Ideally I DON’T use a repeat at all, that is my preference.

So are you saying that I can use one then/else condition on the API source, and it will check the condition against each of the 10 records in the API individually without needing a repeat?

It doesn’t make sense to use it like that.
No, the condition won’t check against all the records in the data source without a repeat and using a repeat with filter like that makes no sense.
I don’t think this is suitable in your case.

It will work if you have something like:

user role returned by a single query or just as a single value by some other data source.
condition user role == 123
then > filter show 10 columns
else > show 5 columns

1 Like

Thanks Teodor, I won’t proceed down that path then.

Appreciate the feedback.