Google Spreadsheets answer based on two columns

(Victor J) #1

I am a bit stuck. Is it possible to return the result (column 3) which satisfies the condition: Input 1 is in column 1 and input 2 is in column 2.

(Karen Barker) #2

Hi Victor,

Using the standard Flow XO Google Sheets integration unfortunately it isn’t possible to search on multiple columns. :pensive: However, you can use the code service to then run through the results of the search and pull out all that match the 2nd column as well.

Below is an example of the code that would be needed in order to do this.

If you need any further help with this please feel free to contact me at support@flowxo.com and I’ll happily help out further. :slight_smile:

1 Like
Filter in two columns
(Victor J) #3

Works like a charm! Thanks.
However given the fact that I will have much more combinations than rather A,B and C maybe I should think of a different method. Maybe I could 1. Look row. 2. Look column = output intersection? This also might be faster on the system no?

I was thinking maybe getting the index of row in for var 1 and index of a column for var 2 --> return value from index (var1;var2)

(Karen Barker) #4

Hi Victor,

I’m not sure I’m quite following here - sorry :confused:

What exactly are your search conditions? For example:

So in my above examples I’m asking for 2 cities off the user and wanting to return the distance to the user.

In the left hand example I would need to search on column 1 for the 1st city name, then run through the code I shared above to return the correct row and be able to respond with the distance.

If your data is set up more like the right hand version the in this example I would just need to search for the 1st city in the Starting City column. This would return the whole row to me and I could just use the result of this search to give the user the value in the column with the 2nd city name.

If I’ve not understood what you’re trying to do I apologise and please do write into support@flowxo.com and we can definitely take a closer look at this for you. :slight_smile:

(Xyz Zyx) #5

Hi @KarenBarker, I am actually trying to do something similar where I need to match values with 4 columns and return the value stored in the 5th column, like if value1=column1 and value2 = column2 and value3 = column3 and value4 = column4 then return value from column5. Could you please tell me what changes would be required in the code above to implement this? Can I return this values to a chatfuel bot through a http post request?

(Sarah Palombo) #6

@xyz_zyx

We’re not able to write custom code but as long as you have the experience, our code service could allow you to match more than one result.

Our Code Service allows custom JavaScript to be executed and the result passed back into the flow. Referencing those docs might provide some guidance (or perhaps you have a team that can work with the code service to build the custom query that you can use in your flow). :bulb:

Good luck ! :slight_smile:

Feel free to share with other users if you do champion this :trophy:

(Xyz Zyx) #7

Thank you @sarahpalombo. I just have one question, I have managed to do what I want to, I am just facing problems regarding the format to use the result generated.
Result is in this form:
{
“x”: “[“column1: value1, column2: value2, column3: value3, column4: value4”]”
}

How do I display this in the http post thereafter?
This what I have tried but no luck:

(Daniel Beckett) #8

@xyz_zyx

The docs on Data Outputs should hopefully give you a better idea on how to work with the data.

If you keep running into problems you could share your flow with the support team by emailing support@flowxo.com and we’ll try to offer more suggestions from there :slight_smile: