Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
shaikbakshu
Contributor
Contributor

How to take back up of editscript code from existing Load Script

Hi Troyansky,

I am new to qlikview,

I got an requirement form team,

If it is any Edit Script is available to export Edit Script to some another location like create system tables creation like.

Can you please help me to this.

Thanks and regards,

Bakshu.

6 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

"Can any one please suggest me to how to  write Edit script in Qlikviw to Export Edit script code into some other location."


if I understand correctly, you need to export your script and use it in another application?

if yes, you need to go to your script editor, then "files", "export to a script file"

save your file as a *.qvs

you can copy it's contenent then in any other application.

don't worry about the tabs, just copy the file contenent as it is and load the application, this will create your script tabs.

hope it's helpfull

regards,

QlikView Qlik Sense consultant
shaikbakshu
Contributor
Contributor
Author

Hi Khalil,

Thank you for your response,

Actually my requirement is I have some .QVW files, in this files I have "Edit Script" in this edit Script I have Connection string and Load Tables information are there. So when I was load this .QVW file into another .QVW file by using "Binary load" then automatically Edit Script will be stored into another location.

Ex:

Binary(D:\Bakshu\QLIKVIEW\sample.qvw);

In this "sample.qvw" file i have Load script , so my requirement is this sample.qvw file will load into another .qvw file like any datamodel.qvw file , when I was reload this datamodel.qvw file then automatically stored "sample.qvw" Edit Script into some another location.

Could you please help me for this.

Thanks and regards,

Bakshu.

balabhaskarqlik

Create a macro like this:

Sub ExportQVSFile

    set docprop =  ActiveDocument.GetProperties

    wd = docprop.MyWorkingDirectory

    wdEx = wd & "\Scripts\"

    Set  fileSystemObject = CreateObject("Scripting.FileSystemObject")

    If  Not fileSystemObject.FolderExists(wdEx) Then

            fileSystemObject.CreateFolder(wdEx)

    End If

    set  fileSystemObject = Nothing

    vPathApp = ActiveDocument.Name

    vCommandQt =  "substringcount(" & "'" & vPathApp &  "'" & ", '\') + 1"

    qt = ActiveDocument.Evaluate(  vCommandQt )

    vCommandQvwExt =  "subfield(" & "'" & vPathApp & "'"  & ", '\'," & qt & " )"

    vNameFileQVW =  ActiveDocument.Evaluate( vCommandQvwExt )

    vCommandQVW = "subfield("  & "'" & vNameFileQVW & "'" & ", '.',  1)"

    vNameFile = ActiveDocument.Evaluate(  vCommandQVW )

    fPath = wdEx & vNameFile &  ".qvs"

    Set objFSO =  CreateObject("Scripting.FileSystemObject")

    Set objTextFile =  objFSO.OpenTextFile (fPath,2,True)

    objTextFile.Write(ActiveDocument.GetProperties.Script)

    objTextFile.Close()

    msgbox("Arquivo QVS exportado com sucesso!!")

End Sub

Change some paths as you required.

Refer this:

export script into txt file | Qlik Community

shaikbakshu
Contributor
Contributor
Author

Hi Bala,,

Thank you for this post,

Yes it is working fine, but my requirement is I was load .QVW files into Binary load by using .bat file.

My Batch File is:

Batchfile1:

@ECHO OFF
setlocal enabledelayedexpansion
set /p Install="Enter QlikView installation directory : "
set /p QVW_Dir="Enter Dashboards source directory : "
set /p Target="Enter datamodel CSVs export directory : "
set /p QV="Enter QlikView script directory : "


for %%f in ("%QVW_Dir%\*.qvw") do (

  CALL CSV_DMGenerator-2.bat "%Install%" "%%~nf" "%QVW_Dir%" "%Target%" "%QV%"
)

pause

Batchfile2:

echo Converting Data Model..................................

(

"%~1\Qv.exe" /r  "/vTab=%~2" "/vQVW_Dir=%~3" "/vQVD_Dir=%~5" "/vTarget=%~4" "/vQV=%~6" "%~5\datamodel.qvw"

)

Ex:

BINARY [$(QVW_Dir)\$(Tab).qvw];

Above is the my Edit Script and .Bat file .

In this .Bat file we run looping like one .QVW file is completed then take another .QVW file like.


i want to export Edit Script  from access Binary load .QVW file with out using Any MACRO.


So can you please help me for this.


Thanks and regard,

Bakshu.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You can load an entire data model from another QVW into the current document using the BINARY statement, but you cannot store that same data model into a different QVW file depending on some name in some variable. Another issue may be that a QlikView document isn't stored on disk until after the script has completed successfully. At that point, you are left with two choices: let an external program make a copy of your freshly reloaded QVW to the new location, or again use a macro triggered by a PostReload event that first stores the document and then copies it to the new location. But I'm not sure whether the latter is even possible.

shaikbakshu
Contributor
Contributor
Author

Hi Peter,

Than you for your conformation. I want some Clarification  is it requirement,

It is possible to export edit script  when I was using Binary load ".qvw file edit script" to store another file like .txt file with out using any macros means it is any script available to write in current Edit Script only like create System Tables creation.

If it is possible Please let me know the script and give me the conformation.

Thanks and regards,

Bakshu.