Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Script on how to get data by first four number?

Hi,

Can someone help me on how to do the script for the query below?

Data Sample:

Clearing Doc     Doc number

20001234          50029384

15002472          50028462

20009009          50029847

15001111          50048292

20008302          50092842

Query: If Clearing doc starts with 2000, then clearing doc = Payment Run, otherwise, Manual Check, (count doc number)

Thank you

- Ahyel

1 Solution

Accepted Solutions
Not applicable

Re: Script on how to get data by first four number?

Hi Ahyel,

I believe this is close to what you are looking for:

TableName:

Load

     If (LEFT([Clearing Doc], 4) = 2000, [Payment Run], [Manual Check]) as FieldName

FROM [File/Source];

4 Replies
jagan
Not applicable

Re: Script on how to get data by first four number?

Hi,

Try like this

Data:

LOAD *,

If([Clearing Doc] Like '2000*', 'Payment Run', 'Manual Check') AS Type

INLINE [

Clearing Doc,     Doc number

20001234,          50029384

15002472,          50028462

20009009,          50029847

15001111,          50048292

20008302,          50092842];

Payment Run Count:

Count({<Type={'Payment Run'}>} Clearing Doc)

Manual Check Count:

Count({<Type={'Manual Check'}>} Clearing Doc)

Regards,

Jagan.

jsaradhi
Not applicable

Re: Script on how to get data by first four number?

left function should help here

if(left([Clearing Doc],4)=2000,'y','n')

Not applicable

Re: Script on how to get data by first four number?

Hi Ahyel,

I believe this is close to what you are looking for:

TableName:

Load

     If (LEFT([Clearing Doc], 4) = 2000, [Payment Run], [Manual Check]) as FieldName

FROM [File/Source];

Not applicable

Re: Script on how to get data by first four number?

Hi Wes,

This is perfect! Thank you so much!

- Ahyel