Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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];

View solution in original post

4 Replies
jagan
Luminary Alumni
Luminary Alumni

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.

Anonymous
Not applicable
Author

left function should help here

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

Not applicable
Author

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
Author

Hi Wes,

This is perfect! Thank you so much!

- Ahyel