Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mab_koz
Partner - Contributor II
Partner - Contributor II

Use Qlik Sense fields to send SQL query to Postgres server

Hi community!

I am developing a Qlik Sense app and in my script I would like to send a SQL query to Postgres with Qlik fields in order to execute it and send me back the results to be displayed in Qlik. 

I have a table loaded in Qlik Sense, which has 3 columns (numeric values (double precision in SQL language)). What I want to do is to call a function declared in Postgres and use the 3 fields as arguments to the functions. The problem is that the function only accepts single values, I want to execute it for every record in my Qlik table. 

For example : 

Here is my table in Qlik : 

A            | B          | C

220.2   | 250.0  | 250

250.6   | 280.0 | 300

250.9  | 290.0  | 320

 

I want to execute this : 

ST_Transform(st_pointz("A","B","C",9895), 4937) for every record and get the result in a table.

So, i need to have in a new table, these results : 

ST_Transform(st_pointz("220.2"  , "250.0" , "250", 9895), 4937)

ST_Transform(st_pointz("250.6"   , "280.0" , "300", 9895), 4937)

ST_Transform(st_pointz("250.9" ,  "290.0"  , "320",9895), 4937)

I did one solution, which consists of looping over the table and getting the "i" value, send the request to postgres and get the data in a table, then increment the i and do the same thing with the next line... It does the job, but when in production I will have thousands or millions of record data, it is going to be so heavy and it will have a negative impact on the performance ! 

So please, can you help me with a few hints ? 

Thank you in advance!

Labels (2)
0 Replies