Page Index Toggle Pages: 1 2 [3]  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) Refresch appropriate Data from ascii  to a Form (Read 4490 times)
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Refresch appropriate Data from ascii  to a For
Reply #30 - Aug 19th, 2005 at 4:59pm
Print Post Print Post  
Hello Dr. Belhareth,

Give this code a try whenever you have the opportunity.

Code
Select All
Var vData as String
Var vRecData as String
Var vItem as String
Var vCnt as Int
Var vLoop as Int
Var vRecCnt as Int
Var vRecLoop as Int
Var vQuit as Int
Var vResult as Double
Var vCustNum as String


SetStringArraySeparator(@Newline())
//Get all Data in the File for this Customer

vCustNum = @Str(CustNum)
If @InStr(vCustNum, ",") > 0 Then
{
	vCustNum = @Left(@Str(CustNum), @Len(@Str(CustNum)) - 1)
}
vData = @SearchStringArray(gsFile, vCustNum + "..")

//You can remove these next two lines after everything is working fine
writeln("Searching for a customer number of [" + vCustNum + ".." + "]")
writeln("Length of vData " + @Str(@Len(vData)))

//Remove the data for this customer from the file as it is no longer needed.
gsFile = @DifferenceStringArray(gsFile, vData)

vCnt = @CountStringArray(vData)
vLoop = 1
vRecCnt= @FormResultSetTotal("NewForm0")
vRecLoop = 1
vQuit = 0

//Loop through the data from the text file
While vLoop <= vCnt
{
 vRecData = @AccessStringArray(vData, vLoop)
 RestoreStringArraySeparator()
 //Parse apart
 vItem = @AccessStringArray(vRecData, 2)
 vResult = @AccessStringArray(vRecData, 3)

 //Loop through the subform looking for the record that matches
 While ((vRecLoop <= vRecCnt) And (vQuit = 0))
 {
  If @FormFieldValue("NewForm0", "Metal Type", vRecLoop) = vItem Then
  {
   //Record found. Lets put the result in the subform.
   FormFieldValue("NewForm0", "Result", vRecLoop, vResult)
   If @ToMoney(@FormFieldValue("NewForm0", "Result", vRecLoop)) <> vResult Then
   {
    Writeln("Failed to set the result Element on record " + vRecLoop)
   }
   vQuit = 1
  }
  vRecLoop = vRecLoop + 1
 }
 vRecLoop = 1
 vQuit = 0
 SetStringArraySeparator(@Newline())
 vLoop = vLoop + 1
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Refresch appropriate Data from ascii  to a For
Reply #31 - Aug 20th, 2005 at 9:48am
Print Post Print Post  
Hello Ray,
Nice !
Ray the code works great.
You definitivly have the clear vision and sound ideas as to what can be done.

Thank you very much
     Thank you very much
        Thank you ...

Dr. Belhareth
Germany
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send Topic Send Topic Print Print