Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

gidon500
Contributor II

Store to txt file encoding ansi

Hello

I am using this script

aa:
LOAD * INLINE [
F1
1
2
3
4
]
;

STORE * from aa into aaa.txt (txt) ;

setting is:  

default export encoding is ansi  in document properties

default user setting is Encoding ansi

the problem is that the aaa.txt file encoding is UTF-8

I need it ansi .

what am I doing wrong  ?

thanks

gidon

1 Solution

Accepted Solutions
MVP
MVP

Re: Store to txt file encoding ansi

The STORE command in QlikView always produces UTF8 encoded files. If you need a different encoding you will need to do it via macro (credit to chriscammers) or out of QlikView, with a command line program you can call from the script using EXECUTE, for example.

11 Replies
MVP
MVP

Re: Store to txt file encoding ansi

The STORE command in QlikView always produces UTF8 encoded files. If you need a different encoding you will need to do it via macro (credit to chriscammers) or out of QlikView, with a command line program you can call from the script using EXECUTE, for example.

YoussefBelloum
Esteemed Contributor

Re: Store to txt file encoding ansi

Hi,

Store command use only UTF format.

for other formats you must use Macros

gidon500
Contributor II

Re: Store to txt file encoding ansi

thanks

gidon500
Contributor II

Re: Store to txt file encoding ansi

thanks

gidon500
Contributor II

Re: Store to txt file encoding ansi

Hi

I am using this macro

Sub ExportToTextfile

    Set tableObject = ActiveDocument.GetSheetObject("TB19")

    tableObject.Export "C:\Users\Gidon\Desktop\New folder\TEST.txt",Chr(9) 

End  Sub

it works great but how can I store without the lables  .

thanks

gidon

gidon500
Contributor II

Re: Store to txt file encoding ansi

Hi

I am using this macro

Sub ExportToTextfile

    Set tableObject = ActiveDocument.GetSheetObject("TB19")

    tableObject.Export "C:\Users\Gidon\Desktop\New folder\TEST.txt",Chr(9) 

End  Sub

it works great but how can I store without the lables  .

thanks

gidon

MVP
MVP

Re: Store to txt file encoding ansi

With that script, you cannot, because you are calling an object (TB19) which does not exist at the time of loading the script.

Instead you will need to create a table in the script itself which contains all the data you want to save with that encoding. Then you use the Call function:

TableToAnsi:

LOAD *

RESIDENT Othertable;

Call ExportToTextfile(); // the macro stores the results of the table "TableToAnsi" into the TXT file.

// more script here

What I have seen more often is to first STORE the file as TXT which is UTF8 and then use the macro call to convert that TXT file from UTF8 to Windows1252 or the ANSI you need to use.

gidon500
Contributor II

Re: Store to txt file encoding ansi

hi

I get syntax error when I run this script

what am I doing from

gidon

MVP
MVP

Re: Store to txt file encoding ansi

Which script?

Community Browser