title: Crystal Reports Formula to generate a random number
body: <p>Let assume</p>
  
  <p>x = 1001
  Now I am inputting x to my code and generating y in the following order:</p>
  
  <pre><code>Length of 1001 is 4 so starting from the last number 
  </code></pre>
  
  <p>i.e. 1(number) * 4(position of number) &amp; 0 * 3 &amp; 0 * 2 &amp; 1 * 1 that gives a new number 4001</p>
  
  <p>Another eg. 1234 gives 16941</p>
  
  <p>In crystal I am creating a formual as follows:</p>
  
  <pre><code>stringvar tmp_EventNo;
  stringvar tmp_Password;
  numbervar i;
  numbervar m_password;
  
      tmp_EventNo = Trim(ToText({GR_EVENT.event_number}));
      For i := Len(tmp_EventNo) To 1 Step -1 Do 
          (
          tmp_PassWord = tmp_PassWord &amp; Trim(ToText(Val(Mid(tmp_EventNo, i, 1)) + i));
          );                   
      m_Password = Val(tmp_PassWord);
  
  m_password
  </code></pre>
  
  <p>But it doesnt seem to work. Just results in 0.00</p>
  
  <p>Please help thanks in advance</p>