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

Qlik Cloud e Conector Rest - Variáveis na URL

Olá, pessoal

Estou testando o conector REST na Qlik Cloud.

No Qlikview, em minhas URLs de requisição via REST, normalmente insiro variáveis nos valores de certos parâmetros, direto no load script.

A minha dificuldade no Sense Cloud é que essa mesma URL fica isolada à parte do load script, como uma conexão de dado, evidenciado mais ou menos assim no script:

LIB CONNECT TO [Tabela (qlikcloud_qlikid_nomeusuario)];

A URL em si "some" do load script no caso aqui.

De que maneira posso alterar dinamicamente os parâmetros da URL, da mesma forma que faço no Qlikview?

Obrigado!

Labels (2)
1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Procurei na documentação aqui, tem uma possível solução.

Não tive como testar

SELECT statement syntax with the REST Connector ‒ Qlik Connectors

View solution in original post

3 Replies
Clever_Anjos
Employee
Employee

Procurei na documentação aqui, tem uma possível solução.

Não tive como testar

SELECT statement syntax with the REST Connector ‒ Qlik Connectors

Clever_Anjos
Employee
Employee

Faltou o código:

LIB CONNECT TO 'REST-Google-custom (abc_admin)';

// Action required: Implement the logic to retrieve the total records

// from the REST source and assign to the 'total' local variable.

Let total = 0;

Let totalfetched = 0;

Let startAt = 0;

Let pageSize = 100;

for startAt = 0 to total step pageSize

RestConnectorMasterTable:

SQL SELECT

.

.

.

.

FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION(Url "https://content.googleapis.com/calendar/v3/calendars/primary/events?key=AIzaS...");

// Action required: change URL included in 'WITH CONNECTION' as

// needed to support pagination for the REST source.

// Please see the documentation for "Loading paged data."

NEXT startAt;

tucahernandes
Contributor II
Contributor II
Author

Obrigado pela indicação, Clever

Deu certo aqui. A minha requisição era referente a posts do Facebook. Compartilho abaixo o código, com as variáveis vID e vToken.

For each vID in '171169022896525','357274534427476';

SET vToken='VALOR DO TOKEN - CONFIDENCIAL';

Set dataManagerTables = 'data';

For each name in $(dataManagerTables)

    Let index = 0;

    Let currentName = name;

    Let tableNumber = TableNumber(name);

    Let matches = 0;

    Do while not IsNull(tableNumber) or (index > 0 and matches > 0)

        index = index + 1;

        currentName = name & '-' & index;

        tableNumber = TableNumber(currentName)

        matches = Match('$(currentName)', $(dataManagerTables));

    Loop

    If index > 0 then

            Rename Table [$(name)] to [$(currentName)];

    EndIf;

Next;

LIB CONNECT TO [Feed FB (qlikcloud_qlikid_NOMEUSUARIOQLIKCLOUD)];

[data]:

LOAD

[created_time],

[message],

[id]

[__FK_data] AS [data.Feed FB (qlikcloud_qlikid_tucahernandes)_root..__KEY_root];

SQL SELECT

(SELECT

"created_time",

"message",

"id",

"__FK_data"

FROM "data" FK "__FK_data")

FROM JSON (wrap on) "root" PK "__KEY_root" QDL

WITH CONNECTION(Url "https://graph.facebook.com/v2.10/$(vID)/feed?access_token=$(vToken)");

next vID;