<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IBAN-Check (Java script to QV-load script) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1620523#M597402</link>
    <description>&lt;P&gt;Wow this great, thank you very much!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Apologies for my late reaction (was on holiday).&amp;nbsp;You really helped me a lot.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2019 12:10:23 GMT</pubDate>
    <dc:creator>cdss-developer</dc:creator>
    <dc:date>2019-09-05T12:10:23Z</dc:date>
    <item>
      <title>IBAN-Check (Java script to QV-load script)</title>
      <link>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1608140#M597399</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want to build a IBAN (Bankaccount) check script to see if the bankaccount is valid.&amp;nbsp;&lt;BR /&gt;I found this piece of code online. But it's java. Can anyone help me to convert this to a QlikView load script?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Greetings,&lt;BR /&gt;Eelco&lt;/P&gt;&lt;P&gt;function alertValidIBAN(iban) {&lt;BR /&gt;if(iban==null){&lt;BR /&gt;alert(isValidIBANNumber(document.getElementById("iban").value));&lt;BR /&gt;}else{&lt;BR /&gt;alert(isValidIBANNumber(iban));&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;/*&lt;BR /&gt;* Returns 1 if the IBAN is valid&lt;BR /&gt;* Returns FALSE if the IBAN's length is not as should be (for CY the IBAN Should be 28 chars long starting with CY )&lt;BR /&gt;* Returns any other number (checksum) when the IBAN is invalid (check digits do not match)&lt;BR /&gt;*/&lt;BR /&gt;function isValidIBANNumber(input) {&lt;BR /&gt;var CODE_LENGTHS = {&lt;BR /&gt;AD: 24, AE: 23, AT: 20, AZ: 28, BA: 20, BE: 16, BG: 22, BH: 22, BR: 29,&lt;BR /&gt;CH: 21, CR: 21, CY: 28, CZ: 24, DE: 22, DK: 18, DO: 28, EE: 20, ES: 24,&lt;BR /&gt;FI: 18, FO: 18, FR: 27, GB: 22, GI: 23, GL: 18, GR: 27, GT: 28, HR: 21,&lt;BR /&gt;HU: 28, IE: 22, IL: 23, IS: 26, IT: 27, JO: 30, KW: 30, KZ: 20, LB: 28,&lt;BR /&gt;LI: 21, LT: 20, LU: 20, LV: 21, MC: 27, MD: 24, ME: 22, MK: 19, MR: 27,&lt;BR /&gt;MT: 31, MU: 30, NL: 18, NO: 15, PK: 24, PL: 28, PS: 29, PT: 25, QA: 29,&lt;BR /&gt;RO: 24, RS: 22, SA: 24, SE: 24, SI: 19, SK: 24, SM: 27, TN: 24, TR: 26&lt;BR /&gt;};&lt;BR /&gt;var iban = String(input).toUpperCase().replace(/[^A-Z0-9]/g, ''), // keep only alphanumeric characters&lt;BR /&gt;code = iban.match(/^([A-Z]{2})(\d{2})([A-Z\d]+)$/), // match and capture (1) the country code, (2) the check digits, and (3) the rest&lt;BR /&gt;digits;&lt;BR /&gt;// check syntax and length&lt;BR /&gt;if (!code || iban.length !== CODE_LENGTHS[code[1]]) {&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;BR /&gt;// rearrange country code and check digits, and convert chars to ints&lt;BR /&gt;digits = (code[3] + code[1] + code[2]).replace(/[A-Z]/g, function (letter) {&lt;BR /&gt;return letter.charCodeAt(0) - 55;&lt;BR /&gt;});&lt;BR /&gt;// final check&lt;BR /&gt;return mod97(digits);&lt;BR /&gt;}&lt;BR /&gt;function mod97(string) {&lt;BR /&gt;var checksum = string.slice(0, 2), fragment;&lt;BR /&gt;for (var offset = 2; offset &amp;lt; string.length; offset += 7) {&lt;BR /&gt;fragment = String(checksum) + string.substring(offset, offset + 7);&lt;BR /&gt;checksum = parseInt(fragment, 10) % 97;&lt;BR /&gt;}&lt;BR /&gt;return checksum;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:20:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1608140#M597399</guid>
      <dc:creator>cdss-developer</dc:creator>
      <dc:date>2024-11-16T20:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: IBAN-Check (Java script to QV-load script)</title>
      <link>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1609566#M597400</link>
      <description>&lt;P&gt;Hi, see if this scripts helps you. It doesn't have all the validations (especially the regex ones), but maybe a good aproach. I developed two versions, in QV with a macro helper and this one only with script functions so it will run in QS also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MAP_LENGTH:
Mapping
Load * Inline[
CountryCode, Length
AD24 
AE, 23 
AT, 20 
AZ, 28 
BA, 20 
BE, 16 
BG, 22 
BH, 22 
BR, 29
CH, 21 
CR, 21 
CY, 28 
CZ, 24 
DE, 22 
DK, 18 
DO, 28 
EE, 20 
ES, 24
FI, 18 
FO, 18 
FR, 27 
GB, 22 
GI, 23 
GL, 18 
GR, 27 
GT, 28 
HR, 21
HU, 28 
IE, 22 
IL, 23 
IS, 26 
IT, 27 
JO, 30 
KW, 30 
KZ, 20 
LB, 28
LI, 21 
LT, 20 
LU, 20 
LV, 21 
MC, 27 
MD, 24 
ME, 22 
MK, 19 
MR, 27
MT, 31 
MU, 30 
NL, 18 
NO, 15 
PK, 24 
PL, 28 
PS, 29 
PT, 25 
QA, 29
RO, 24 
RS, 22 
SA, 24 
SE, 24 
SI, 19 
SK, 24 
SM, 27 
TN, 24 
TR, 26
];


Sub isValidIBANNumber(TABLE, IBAN_FIELD)

	//Copy of the original table
	[TMP_IBAN_VALIDATION_$(IBAN_FIELD)]:
	Load
		Distinct
		$(IBAN_FIELD) as [TMP_$(IBAN_FIELD)]
	resident $(TABLE);
	
	let vN_IBAN_VALIDATION = NoOfRows('TMP_IBAN_VALIDATION_$(IBAN_FIELD)');
	
	for i = 0 to vN_IBAN_VALIDATION - 1;
	
		Let vIBAN = peek('TMP_$(IBAN_FIELD)',i,'TMP_IBAN_VALIDATION_$(IBAN_FIELD)');

		Let input = keepchar(upper(vIBAN),'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ');
		Let code_01 = Left(input,2);	//Country
		Let code_02 = mid(input,3,2);	//Check digits
		Let code_03 = mid(input,5);		//Rest digits
	
		Let digits = text(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
		replace(
				code_03 &amp;amp; code_01 &amp;amp; code_02,
				'A',
				Ord('A') - 55
				),
				'B',
				Ord('B') - 55
				),
				'C',
				Ord('C') - 55
				),
				'D',
				Ord('D') - 55
				),
				'E',
				Ord('E') - 55
				),
				'F',
				Ord('F') - 55
				),
				'G',
				Ord('G') - 55
				),
				'H',
				Ord('H') - 55
				),
				'I',
				Ord('I') - 55
				),
				'J',
				Ord('J') - 55
				),
				'K',
				Ord('K') - 55
				),
				'L',
				Ord('L') - 55
				),
				'M',
				Ord('M') - 55
				),
				'N',
				Ord('N') - 55
				),
				'O',
				Ord('O') - 55
				),
				'P',
				Ord('P') - 55
				),
				'Q',
				Ord('Q') - 55
				),
				'R',
				Ord('R') - 55
				),
				'S',
				Ord('S') - 55
				),
				'T',
				Ord('T') - 55
				),
				'U',
				Ord('U') - 55
				),
				'V',
				Ord('V') - 55
				),
				'W',
				Ord('W') - 55
				),
				'X',
				Ord('X') - 55
				),
				'Y',
				Ord('Y') - 55
				),
				'Z',
				Ord('Z') - 55
		)
		);		
		
		//function mod97
		Let checksum = left(digits,2);

		for offset = 3 to len(digits) step 7
			fragment = checksum &amp;amp; mid(digits,offset,7)
			checksum = mod(fragment,97)
		next	
	
		[IBAN_VALIDATION_$(IBAN_FIELD)]:
		Load
			'$(vIBAN)'		as [$(IBAN_FIELD)],		//Automatically will link the original field
			//'$(digits)' 	as digits,				//Just for validation purposes
			if(applymap('MAP_LENGTH','$(code_01)',0) &amp;lt;&amp;gt; len('$(input)'),
				0,
				if($(checksum) = 1, 1, 0
				)
			) 	as isValidIBANNumber				//Flag
		autogenerate(1);
	
	
	next
	
	drop Table TMP_IBAN_VALIDATION_$(IBAN_FIELD); //no longer used table
end Sub



//Example data
FT:
LOAD
	F1
INLINE [
    F1
    SE35 5000 0000 0549 1000 0003
    SE35 5000 0000 0549 1000 000
    CH93 0076 2011 6238 5295 7
    DE89 3704 0044 0532 0130 00
    MT84 MALT 0110 0001 2345 MTLC AST0 01S
    MT84 MALT 0110 0001 2345 MTLC AST0 012
];

call isValidIBANNumber('FT','F1'); //Parameter 1:Table Name, 2: Field Name //Just in case there will be more than one field&lt;/LI-CODE&gt;&lt;P&gt;The example data was taken from&amp;nbsp;&lt;A href="https://www.citadele.lt/en/iban-examples/" target="_blank"&gt;https://www.citadele.lt/en/iban-examples/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 21:16:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1609566#M597400</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2019-08-05T21:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: IBAN-Check (Java script to QV-load script)</title>
      <link>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1615528#M597401</link>
      <description>&lt;P&gt;Eelco, did Hector's post do the trick?&amp;nbsp; If so, please be sure to use the Accept as Solution button to give him credit for the help and to let others know it worked.&amp;nbsp; If you did something else, consider letting everyone know what that was and mark that as the solution.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 16:17:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1615528#M597401</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-08-22T16:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: IBAN-Check (Java script to QV-load script)</title>
      <link>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1620523#M597402</link>
      <description>&lt;P&gt;Wow this great, thank you very much!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Apologies for my late reaction (was on holiday).&amp;nbsp;You really helped me a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 12:10:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IBAN-Check-Java-script-to-QV-load-script/m-p/1620523#M597402</guid>
      <dc:creator>cdss-developer</dc:creator>
      <dc:date>2019-09-05T12:10:23Z</dc:date>
    </item>
  </channel>
</rss>

