Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
swethasmilek
New Contributor III

How to count bits or bytes of source text file characters

Hi friends can anyone help on How to validate Errors in QlikView My case we will get .txt file as source while loading we need to validate the bit count for each row.

Eg:Our case we get Source .txt file without any comma or column name based on standard mapping doucument need to find column dimensions and measures.

  1. 00102014060102050002100B10500171200000è38 bits

001-Office(3 bits),

0201406-Period(7 bits)

01020500021-Ship Id(11 bits)

00B105-Code(6 bits)

001-Currency(3 bits)

71200000-Amount(8 bits)

My main Requirement solution I need is always to check record bits size whether it is same or else corrupted with spaces or special characters

  Is it possible to validate null or blank spaces in key columns


13 Replies

Re: How to count bits or bytes of source text file characters

can you provide a short sample file?

saumyashah90
Valued Contributor

Re: How to count bits or bytes of source text file characters

suppose Field=00102014060102050002100B10500171200000è38

count the characters as it is and count it after triming it..Compare both...if not same that means there is some problem else we are good

engishfaque
Valued Contributor III

Re: How to count bits or bytes of source text file characters

Dear Swethasmilek,

Use function "FileSize()" in script to check out the file size.

Kind regards,

Ishfaque Ahmed

saumyashah90
Valued Contributor

Re: How to count bits or bytes of source text file characters

1)

If(len(Field)<> len(Trim(Field)),'Not Good','Good')

swethasmilek
New Contributor III

Re: How to count bits or bytes of source text file  characters

Hi All,

Will QlikView Support Error Handling

00102014060102050002100B10500171200000

00102014060102050002200B106001712537229--> instead of 38 bits it is 39-bit Source is corrupted show as error

00102014060102050002300B10700171203730

00202014070102050002400B10800171200003

00102014060102050002500B10900171200327

00202014060102050002600B11000171200002

00102014060102050002700B11100171203030

00102014060102050002800B11200171200233

00102014060102050002900B11300171200000

00102014060102050003000B10500171200123

00102014060102050003100B10500171200000

00102014060102050003100B10500171200000

00202014060102050002100B10500171200000

00102014060102050002100B10500171209372

00102014060102050002100B10500171202230

00102014060102050002100B10500171200273

00202014070102050002100B10500171200392

All rows of source file will be common 38 bits

1)how to count individual row of source

2)how to validate eroors in Qlikview all are of same bits are else duplicated

saumyashah90
Valued Contributor

Re: How to count bits or bytes of source text file  characters

Can we give header to it?...is this a text file?....we can have one column added  in qlikview internally calculating its number of bits

swethasmilek
New Contributor III

Re: How to count bits or bytes of source text file  characters

We will get source file without any headers or comma separator we differentiate each column base on common template

Eg:Office,Period,Ship Id,code,Currency,Amount all are fixed bits

001-Office(3 bits),

0201406-Period(7 bits)

01020500021-Ship Id(11 bits)

00B105-Code(6 bits)

001-Currency(3 bits)

71200000-Amount(8 bits)


We load in script as

Load
[@1:3]  as [Office],
[@4:10] as [Period],
[@11:21] as [Ship Id],
[@22:27] as [Code],

[@28:30] as [Currency],
[@31:38] as [Amount]

FROM
$(vTxtFile)
(
fix, codepage is 1252);



saumyashah90
Valued Contributor

Re: How to count bits or bytes of source text file  characters

Can you please attach the text file....will provide u the solution

swethasmilek
New Contributor III

Re: How to count bits or bytes of source text file characters

for second row manually entered extra bit ,how to count rows of source and if it has extra bit to show as error.Can any one help on this ASAP