Announcements
cancel
Showing results for
Did you mean:
Contributor III

## field of numbers (debit card)

Hello, I have one task and I would like to ask about it because I can't get through this on my own.
I have 6 numbers in table which are different.

I need that every number from this table was considered as separate field.

Then I have to define algorithm that sorts debit card numbers from the rest. (debit card numbers have 16 digits in my task)

When its done i have to do check calculation. Every odd position multiplies by 2 and when it will be greater then 9 i have to subtract 9 from it.

Then I have to sum ap every digit and if this number will be devisible by 10 then it is a debit card number.
I am pretty new with qlik and don't know about all functions qlik offers so be patient with me please.

This is the field:

I need to make another column where will be written if it is debit card or not

```0902657128
4170849152244725
4278489315951451
4052363869903238
+420732915435
4033657502952419

```
1 Solution

Accepted Solutions
Creator III

General idea for your computation goal:

• Filter values with length = 16 using a WHERE clause
• Extract each digit as a column, namely Num1 to Num16, in a temp table with Mid() function
• Check odd positions with an IF statement
• Use RangeSum() to sum Num1 to Num16. Check if this sum is divisible by 10 with Mod() function

Check attached qvw document for a demonstration.

4 Replies
Creator III

General idea for your computation goal:

• Filter values with length = 16 using a WHERE clause
• Extract each digit as a column, namely Num1 to Num16, in a temp table with Mid() function
• Check odd positions with an IF statement
• Use RangeSum() to sum Num1 to Num16. Check if this sum is divisible by 10 with Mod() function

Check attached qvw document for a demonstration.

Contributor III
Author

Thank you so much:)))

Contributor III
Author

Hi, sorry for bothering again but do you know how could i write script for when the number which doesnt have 16 digits would be marked in IsDebit as "No" ? Thanks

Creator III

You can add the following at the end of the script

```Concatenate (Numbers_temp)