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: 
datanibbler
Champion
Champion

BINARY command to be constructed dynamically

Hi,

this is a follow-up to a previous thread that I had:

For a report to be run locally that uses several tables, I want to load all those tables into an inbetween_app and then load it all BINARY. There are two databases, so there can be two different BINARY commands.

Currently, I have a dropdown_box on the GUI where the user has to select the BINARY command prior to starting the script, that's just fine. The only thing is, the user sees the entire statement in the box and has to select it, but only a very small part of the path to the inbetween_app is different - only the plant_ name - so I'd like to just have the user select one plant, and the statement would be constructed automatically.

I can do that using a LET statement in the script - but the BINARY command has to be the very first in the script, so I'd have to nest the two.

I think it is possible in QlikView to have like two dollar-sign-expansions nested into each other. That's where I need a little help.

My LET_statement currently looks like this:

LET v_Binary_command_v3 = '\\rgb1app202\production\01_qvd\qvd\versanddatensuche_' & '$(v_Werk)' & '_pre.qvw';

(v_Werk is the name of one of the plants, the user selects this on the GUI)

I think I'll now have to somehow integrate this LET statement into the BINARY statement itself.

That's just where I am with this ...

Thanks for any help here!

Best regards,

DataNibbler

4 Replies
marcus_sommer

Hi DataNibbler,

you don't need to create the variable within the script per LET statement - it's sufficient to create these variable within the variable-overview and they will be persistent in the application.

- Marcus

petter
Partner - Champion III
Partner - Champion III

Like Marcus said you can set your v_Werk in the GUI in the app. This can be done either via an InputBox or via actions and buttons.

The the binary statement could look like this:

BINARY [\\rgb1app202\production\01_qvd\qvd\versanddatensuche_$(v_Werk)_pre.qvw];

You could even do this

BINARY $(v_Path1)$(v_Werk)$(v_Path2];


So you could then have full control of the other two parts of the path from the GUI too.

swat_agar
Contributor
Contributor

Hi Marcus,

 

I am creating the variable using the variable-overview but it is not evaluating the expression at runtime. In my binary load statement, when I am using that variable; it is not using the evaluated value rather the expression as a string. Could you please suggest a workaround here?

marcus_sommer

Probably the only workaround is to use two variables - one with the expression and one with the fixed value. This could be done manually within the variable-overview or with a macro triggered by an OnChange of the variable or maybe an OnPostReload/OnOpen whereby I doubt that these logic fits very well in your binary-load approach - means you may need another in-between step in your workflow which may from an overall point of view rather disturbing as be helpful.

Nevertheless you could try if you could adapt something from the below code - which is a macro which runs through an inputbox and writes their expression-results as fixed values within a variable-twin:

sub TransferVariableValuesFromCalculatedVariablesToFixedVariables

set table = ActiveDocument.GetSheetObject( "IB03" )

for RowIter = 0 to table.GetRowCount-1
for ColIter =0 to table.GetColumnCount-1
set cell = table.GetCell(RowIter,ColIter)
if ColIter = 0 then
vVariable = cell.Text & ".v"
end if
if ColIter = 2 then
vVariableValue = cell.Text
end if
next
set v = ActiveDocument.Variables(vVariable)
v.SetContent vVariableValue, true
next

end sub

- Marcus