Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
decimatum
Contributor III
Contributor III

tDBInput using tDBConnection dynamically

Hi, I am trying to use database connections dynamically for example

I have 3 tDBConnections

  1. tDBConnection_1, tDBConnection_2,tDBConnection_3

In my tDBInput, I want to use a context variable to select which tDBConnection to be used.

For example, context.tDBConnection = "tDBConnection_1"

Is there a way to do so?

Labels (2)
1 Solution

Accepted Solutions
jzhao
Employee
Employee

Just recheck the generated code, when using the dynamic setting in the DB component, need to use a workaround: the dynamic setting should be set:

" + context.connectionid + "

can't set the value directly.

View solution in original post

5 Replies
jzhao
Employee
Employee

Hello,

You can use the Dynamic setting in some Database components:

0695b00000Uy1zAAAR.pngRegards.

decimatum
Contributor III
Contributor III
Author

hm. I tried this. but it did not work.

 

for example , set context.connectionid = "tDBConnection_2" as a string. but does not work.

may i know how you set the context.connectionid?

jzhao
Employee
Employee

it's in Contexts view.

0695b00000Uy229AAB.png

jzhao
Employee
Employee

Just recheck the generated code, when using the dynamic setting in the DB component, need to use a workaround: the dynamic setting should be set:

" + context.connectionid + "

can't set the value directly.

decimatum
Contributor III
Contributor III
Author

Thanks! it works now. " + context.connectionid + " is the solution.