<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — script]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7248</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7248&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in script.]]></description>
		<lastBuildDate>Sun, 03 Jan 2021 00:04:57 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: script]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39611#p39611</link>
			<description><![CDATA[<p>the sum is calculated: <br />1 * a1 + 2 * a2 + 3 * a3 + 4 * a4 + 5 * a5 + 6 * a6 + 7 * a7 + 8 * a8,<br />where a1 is the first digit, a2 is the second, and so on.<br />• the balance under module 11 of the amount is calculated<br />• if the remainder is other than 10, it is defined as the ninth digit<br />• if the remainder is 10, the amount is calculated<br />3 * a1 + 4 * a2 + 5 * a3 + 6 * a4 + 7 * a5 + 8 * a6 + 9 * a7 + 10 * a8,<br />where a1 is the first digit, a2 is the second, and so on<br />• the balance under module 11 of the new amount is calculated<br />• if the remainder is other than 10, it is defined as the ninth digit, and if it is ten - for<br />the ninth digit is set to &quot;0&quot;</p><p>According to your example, 83102340 = 8 + 6 + 3 + 0 + 10 + 18 + 28 + 0 = 73 <br /> if the last 9th digit is 0, it is considered valid.</p><p>It is a question of checking the validity of the UIC under the Bulgarian legislation.</p><p>I did it very easily with PHP, but I&#039;m a beginner with DELPHI.</p><p>I found this, but I can&#039;t embed it in MVD<br /></p><div class="codebox"><pre><code>Function IsDN(dn:String;var code:integer):Boolean;
var
    L,i:integer;
    v,vs,vm:Longint;
begin
    Result:=False;
    dn:=TrimAll_t(dn);
    L:=Length(dn);
    if L&lt;&gt;10 then begin
        Result:=False;
        code:=1;
        Exit;
    end;
    if dn=&#039;9999999999&#039; then begin
               Result:=True;
               Exit;
             end; 
    vs:=0;
    v:=0;
    For i:=1 to L do begin
        if not (dn[i] in [&#039;0&#039;..&#039;9&#039;]) then begin
            {if there are # characters from a number}
            code:=2;
            Exit;
        end;
        v:=StrToIntDef(dn[i],0);
        case i of
            1:vs:=vs+v*4;
            2:vs:=vs+v*3;
            3:vs:=vs+v*2;
            4:vs:=vs+v*7;
            5:vs:=vs+v*6;
            6:vs:=vs+v*5;
            7:vs:=vs+v*4;
            8:vs:=vs+v*3;
            9:vs:=vs+v*2;
        end;{case i}
    end;{For i:=1 to L do begin}
    if vs=0 then begin
        code:=3;
        exit;
    end;
    vm:=vs mod 11;
    case vm of
        0:begin{the last number in the DN must be 0}
                if v&lt;&gt;0 then begin
                    code:=4;
                    exit;
                end;
            end;
        1:begin{wrong DN}
                code:=5;
                Exit;
            end;
        2..10:
            begin
                if v&lt;&gt;(11-vm) then begin
                    code:=6;
                    exit;
                end;          
            end;
    end;{case vm}
  Result:=True;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (iwkom)]]></author>
			<pubDate>Sun, 03 Jan 2021 00:04:57 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39611#p39611</guid>
		</item>
		<item>
			<title><![CDATA[Re: script]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39610#p39610</link>
			<description><![CDATA[<p>iwkom,</p><div class="quotebox"><blockquote><p>Add the result if it is two digits and compare it with the last digit.</p></blockquote></div><p>If the result is two digits, do they get subtracted from the nearest multiple of 10 to produce the check digit?</p><p>Are the numbers added as single digits or as actual numbers?</p><br /><p>Using your formula for example, the eight digit number 83102340 = 8 + 6 + 3 + 0 + 10 + 18 + 28 + 0 = 73, if adding as actual numbers. But if added as single digits the number will be&nbsp; 8 + 6 + 3 +&nbsp; 0 +1 + 0 + 1 + 8 + 2 + 8 + 0 = 38.</p><br /><p>Does the resulting number get deducted from the nearest value of 10&nbsp; which in the above examples would either result in a check digit of either 7&nbsp; or 2?</p><br /><p>If you could clarify the above, a function could be written for you.</p>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 02 Jan 2021 23:19:22 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39610#p39610</guid>
		</item>
		<item>
			<title><![CDATA[script]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39609#p39609</link>
			<description><![CDATA[<p>Hello!<br />I am a beginner and need help with the following:</p><p>I have a TextEdit field in which a 9-digit number is entered.</p><p>During the introduction I want to check if it is valid.<br />The formula is as follows:<br />(1 * a1) + (2 * a2) + (3 * a3) + (4 * a4) + (5 * a5) + (6 * a6) + (7 * a7) + (8 * a8)<br />where a1 to a8 are the first 8 digits.<br />Add the result if it is two digits and compare it with the last digit.</p>]]></description>
			<author><![CDATA[null@example.com (iwkom)]]></author>
			<pubDate>Sat, 02 Jan 2021 19:22:33 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39609#p39609</guid>
		</item>
	</channel>
</rss>
