Very Hot Topic (More than 25 Replies) Refresch appropriate Data from ascii  to a Form (Read 4492 times)
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Refresch appropriate Data from ascii  to a Form
Jun 23rd, 2005 at 11:59am
Print Post Print Post  
Hallo evrybody!

I habe subform with many Items (medical-anlysis Items ).
we get from analyser online the appropriate results.
The results are numbers, Item-Keys und Order number
as Standard ascii with comma delimeter.

I must have some help to integrate the results in the subform and I would be grateful for any tips or tricks.

Thanks
Dr. Belhareth
from Germany
« Last Edit: Jun 23rd, 2005 at 7:47pm by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #1 - Jun 23rd, 2005 at 1:26pm
Print Post Print Post  
Have you checked Sesame User Guide, pages 175, 303-310?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
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 #2 - Jun 24th, 2005 at 4:10pm
Print Post Print Post  
Hello Bob,

I suppose The Copy and the Import Kapitel in the user guide is valable only between 2 Sesame  Databases.

Is this possible  with  a external ascii-file?

Thanks
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #3 - Jun 24th, 2005 at 4:46pm
Print Post Print Post  
Quote:
Is this possible  with  a external ascii-file?

Thanks
Dr. Belhareth


Take a look at the Text File I/O functions and commands starting on page 42 of the new programming guide.

Using commands like  FileReadln() will allow you to easily take data from the ascii file and manipulate it with Sbasic to use in your Sesame application.

Best of luck

P.S. Also check out @insert() command
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #4 - Jun 25th, 2005 at 12:02am
Print Post Print Post  
Quote:
help to integrate the results in the subform
Maybe you could explain differently what you want to do.

Some possible scenarios:
A.  Do you want a new record in a subform for each line?

B.  Would having the entire contents in one multiline field be acceptable.?

C.  Do you want a separate field for every value in the file, or can some data be combined? 

D.  Do you want one field on the subform containing all the values of one line in the file?
-------------------------------------

Can you explain the relationship/purpose of the parent form and the sub form and the ascii file.....

For example the Parent may be a Sales Order, the sub form may be the Line Items on the Sales Order, and the Ascii may be a file containing line items from multiple Sales Orders, or limited to a single Sales Order, etc.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
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 #5 - Jun 25th, 2005 at 11:01am
Print Post Print Post  
Hi Bob,

I try to explain my scenarios:
A. The records in the subform have not to be created.
     they are alrerady saved but resultat field is empty                      because later the analyser will send the data as ascci file

B. The entire contents in one multiline filed is acceptable
    but  not necessary :
hier a typical example of the ascii file for multiple anaysis Order:

CustNr  Code  Item   Resultat
1233;Gil;Glucose;          1.21
1233;Ure;Urea,               1,33
1233;GGT;Gamm-GT;   2,73
1233;Bil;Biluribin;           1,31
1234;Gil;Glucose;          0.90
1234;Ure;Urea,              1.09
1234;GGT;Gamm-GT;  1.35
1234;Bil;Biluribin;          1.12
..
this Items exist already in the Subform AnaylasisItems but without the resultat of analysis!

C.  No I want to import, par example the analyser result       witch in ascii file for the Item Glucose the value 1.21, 
in Resultat field (in the already populated Subform) and for the same CustNr 1233.

D.  The Subform is as Table with the ordered Items.
The parent form and the subform and the ascii file
have a strong relationship with CustNr  and the Item Code

Thank you very much
Dr. Belhareth    Roll Eyes
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #6 - Jun 25th, 2005 at 3:42pm
Print Post Print Post  
Is there a possibility that a patient will get more then one diagnostic evaluation for the same test over a period of time with the same custnr?
Say more then 1 Glucose test?

Where is the diagnostic equipment getting patient data to export with results (entered by a technician?)

A method that has worked well for me is when the procedure is scheduled a child record is created in the subform whith all the data except the results. When this record is created the system assigns a unique number to it (we call this an event number) This number is used as the key to pick up the results from the output file from diagnostic equipment and then post the result to the specific event.

For simplicity in getting the information to diagnostic equipment we print out a sheet with the patient information including custnr and specific event procedure number including all enter keys all in bar code with human readable sub text and then just plug a bar code gun into diagnostic equipment and enter all the accurate data very quickly by just shooting line by line.

Just some things for you to think about.
Smiley
  

Team – Together Everyone Achieves More
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 #7 - Jul 11th, 2005 at 11:03am
Print Post Print Post  
Hi Bob,

I have  absolutly the same Conception for this Project and you undersand exactly what i am looking for.

To your questions:
1) A Patient will get more then one diagnostic evaluation for the same test over a period of Time with the same Custnr. (PatientNr)

2) I have commercial Program with bidirectional capabilty to send to the Analyser via Bar code and get back automatically the data to the Database.
But I have other Analyser manually used  and would like to connect them with my Data in Sesame. I have no Experience to do that, but i want to use the ascii file that i get back from the Analyser.
So the patient data are enterd by a technician.

3) Your method is exactly what i have done and i still want to realise it.
But how kan i post the Result from a Ascii file in the subform?
I thank i mus have a new output file to import the ascii file from the diagnostic equipment an then post the result to the specific event ?. 

Thank you very much again.
Dr.  Belhareth
Germany
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #8 - Jul 11th, 2005 at 3:02pm
Print Post Print Post  
If I understand your question correctly, you have an ASCII output file from your diagnostic equipment and you would like to update/post that data into the your Sesame application into the correct record and subrecord.

As long as the ASCII output file from your diagnostic equipment contains the unique record key that was created when the patient was scheduled and then passed to the Diagnostic device all you need to do is Post to the database in the application that contains that unique record.

There are probably many, many ways to do this and hopefully some of the Gurus like Ray, Bob Hansen, Carl or others will chime in on the best method.

One method I used that worked for me albeit a little clunky was to have a temporary holding database within my application that I used to import the ASCII files into each day and then I ran a mass update from my records database using lookups and posting the results from the temporary database into the correct record. I then removed all the records from the temp database until the next day when new ASCII data was available.

This Technique was used prior to many of the newer commands that the recent version of Sesame offers so I am sure it can be greatly improved.


  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
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 #9 - Jul 11th, 2005 at 6:34pm
Print Post Print Post  
Hello Dr. Belhareth,

One way you could do this is with a mass update from the parent form. I built a sample application that has a parent named "NewForm" and a subform named "NewForm0". On the Parent Form there is one element named "CustNum". It holds the unique key for each record. The subform has three elements, "Pat_ID", "Metal Type" and "Result". "Metal Type" would be comparable to either your code or item element.

The code for the mass update is below.

Code
Select All
** PROGRAMMING SECTION: [ GLOBAL CODE ] [] **
Stat gsFile as String

gsFile = @Insert("ToImport.txt")


** PROGRAMMING SECTION: [CustNum] [Mass Update] **
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

SetStringArraySeparator(@Newline())
//Get all Data in the File for this Customer
vData = @SearchStringArray(gsFile, @Str(CustNum) + "..")
//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
} 



The file that was imported looks like this
Code
Select All
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5 



If you would like to see the application that shows how to accomplish this, just send me an e-mail at support@lantica.com and I will be happy to send it your way along with the file for it to import.

As I was typing this it also occured to me that you don't have to be on the parent form at all. You could use a variation of the code above to do a mass update on the subform database itself.

-Ray
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Refresch appropriate Data from ascii  to a For
Reply #10 - Jul 11th, 2005 at 6:55pm
Print Post Print Post  
Ray,

Wow! now that is a quick and clean solution, Amazing!

This may be a really stupid question but why did you use @Newline() for the string array seperator?

SetStringArraySeparator(@Newline())
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
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 #11 - Jul 11th, 2005 at 7:05pm
Print Post Print Post  
Hello Robert,

I used @Newline() because in the file that is brought in the pieces of data are separated by Carriage returns. This allowed me to operate on that text file as if it was one big string array. Makes searching for and retrieving the appropriate sections easier.

-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 #12 - Jul 13th, 2005 at 4:43pm
Print Post Print Post  
Hello Ray!

Thank you very much for the demonstration.
I do not get any errors when i run the massupdate but it does not change anything!
i have the 3 Files in Folder C:\sesame\data\

Thanks for your help.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #13 - Jul 13th, 2005 at 4:52pm
Print Post Print Post  
Hello Dr. Belhareth,

If you are referring to the three files that I sent you, ToImport.txt needs to be in C:\Sesame in order for it to work.

-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 #14 - Jul 13th, 2005 at 8:37pm
Print Post Print Post  
Hello Ray,

The massupdate does not work in  C:\Sesame   too!


Dr. Belhareth
« Last Edit: Jul 15th, 2005 at 10:53am by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #15 - Jul 13th, 2005 at 8:52pm
Print Post Print Post  
Hello Dr. Belhareth,

In global code of the mass update add the following line on line 4.

Code
Select All
writeln(gsFile) 



So the entire global code section would look like this.
Code
Select All
Stat gsFile as String

gsFile = @Insert("ToImport.txt")
writeln(gsFile) 



Does anything appear in the window that pops up?

-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 #16 - Jul 14th, 2005 at 4:50pm
Print Post Print Post  
Hello Ray,

with the Import file  without path  It still not working and does anything appear in the window that pops up !

With the path " C:\sesame\ToImport.TxT"  a get the file in the editor bat the import does not happen!

Thank you for taking the time to make such a nice post! 

Dr. Belhareth
« Last Edit: Jul 15th, 2005 at 10:55am by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
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 #17 - Jul 20th, 2005 at 8:44pm
Print Post Print Post  
Hello Ray,

with the Import file  without path  It still not working and does anything appear in the window that pops up !

With the path " C:\sesame\ToImport.TxT"  a get the file in the editor bat the import does not happen!

Thank you for taking the time to make such a nice post! 

Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #18 - Jul 20th, 2005 at 9:18pm
Print Post Print Post  
Hello Dr. Belhareth,

Leave the path in Global Code as "C:\sesame\ToImport.txt" for the following tests.

Replace the code in the CustNum Mass Update event with the following code

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

writeln("gsfile contains [" + gsfile + "] #1")

SetStringArraySeparator(@Newline())
//Get all Data in the File for this Customer
vData = @SearchStringArray(gsFile, @Str(CustNum) + "..")

writeln("vData contains [" + vData + "]")

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

writeln("gsfile contains [" + gsfile + "] #2")

vCnt = @CountStringArray(vData)
writeln("Number of recs " + @str(vCnt))
vLoop = 1
vRecCnt= @FormResultSetTotal("NewForm0")
writeln(@str(vRecCnt) + " Records in the subform")
vRecLoop = 1
vQuit = 0

//Loop through the data from the text file
While vLoop <= vCnt
{
 vRecData = @AccessStringArray(vData, vLoop)
writeln("RecData is [" + vRecData + "]")
 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
  {
writeln("Found a match")
   //Record found. Lets put the result in the subform.
   FormFieldValue("NewForm0", "Result", vRecLoop, vResult)
writeln("Value set to " + @FormFieldValue("NewForm0", "Result", vRecLoop))
   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
} 



Run the mass update.
Copy every thing that shows up in the WriteLn window. Ctrl C will copy from that window.
Paste it here so I can see what is happening.

-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 #19 - Jul 23rd, 2005 at 9:38pm
Print Post Print Post  
Hello Ray,
after running the massupdate i get:

3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 0
10 Records in the subform

Thanks.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #20 - Jul 25th, 2005 at 2:04pm
Print Post Print Post  
Hello Dr. Belhareth,

There is more to the debug than what you posted. What you will need to do is click at the end of the debug, hold down the shift key, and keep hitting the up arrow to select all the debug.

-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 #21 - Aug 17th, 2005 at 11:27am
Print Post Print Post  
Hello Ray !

I am back und thank you for the support.
After running the massupdate i get this debug:

1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109

Thanks.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #22 - Aug 17th, 2005 at 1:43pm
Print Post Print Post  
Dr. Belhareth,

The entire debug should look more like this. I believe you are still missing some of it.

gsfile contains [1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109
] #1
vData contains [1;Silver;12341;Plat;123.41;Iron;12.34]
gsfile contains [2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 3
5 Records in the subform
RecData is [1;Silver;1234]
Found a match
Value set to 1234.000000
RecData is [1;Plat;123.4]
Found a match
Value set to 123.400000
RecData is [1;Iron;12.34]
Found a match
Value set to 12.340000
gsfile contains [2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains [2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7]
gsfile contains [3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 7
7 Records in the subform
RecData is [2;Tita;1]
Found a match
Value set to 1.000000
RecData is [2;Alum;2]
Found a match
Value set to 2.000000
RecData is [2;Plat;3]
Found a match
Value set to 3.000000
RecData is [2;Silver;4]
Found a match
Value set to 4.000000
RecData is [2;Gold;5]
Found a match
Value set to 5.000000
RecData is [2;Ore;6]
Found a match
Value set to 6.000000
RecData is [2;Iron;7]
Found a match
Value set to 7.000000
gsfile contains [3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains [3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13]
gsfile contains [4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 13
13 Records in the subform
RecData is [3;Silver;1]
Found a match
Value set to 1.000000
RecData is [3;Iron;2]
Found a match
Value set to 2.000000
RecData is [3;Tungsten;3]
Found a match
Value set to 3.000000
RecData is [3;Alloy;4]
Found a match
Value set to 4.000000
RecData is [3;Aluminum;5]
Found a match
Value set to 5.000000
RecData is [3;Plat;6]
Found a match
Value set to 6.000000
RecData is [3;Gold;7]
Found a match
Value set to 7.000000
RecData is [3;Nickel;8]
Found a match
Value set to 8.000000
RecData is [3;Tita;9]
Found a match
Value set to 9.000000
RecData is [3;Steel;10]
Found a match
Value set to 10.000000
RecData is [3;Stainless;11]
Found a match
Value set to 11.000000
RecData is [3;Brass;12]
Found a match
Value set to 12.000000
RecData is [3;Copper;13]
Found a match
Value set to 13.000000
gsfile contains [4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains [4;Silver;14;Gold;24;Brass;34;Copper;4]
gsfile contains [5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 4
3 Records in the subform
RecData is [4;Silver;1]
Found a match
Value set to 1.000000
RecData is [4;Gold;2]
Found a match
Value set to 2.000000
RecData is [4;Brass;3]
Found a match
Value set to 3.000000
RecData is [4;Copper;4]
gsfile contains [5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains [5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109]
gsfile contains [] #2
Number of recs 10
10 Records in the subform
RecData is [5;Copper;100]
Found a match
Value set to 100.000000
RecData is [5;Iron;101]
Found a match
Value set to 101.000000
RecData is [5;Steel;102]
Found a match
Value set to 102.000000
RecData is [5;Nickel;103]
Found a match
Value set to 103.000000
RecData is [5;Brass;104]
Found a match
Value set to 104.000000
RecData is [5;Gold;105]
Found a match
Value set to 105.000000
RecData is [5;Silver;106]
Found a match
Value set to 106.000000
RecData is [5;Alloy;107]
Found a match
Value set to 107.000000
RecData is [5;Alum;108]
Found a match
Value set to 108.000000
RecData is [5;Tita;109]
Found a match
Value set to 109.000000


-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 #23 - Aug 17th, 2005 at 5:22pm
Print Post Print Post  
Hello Ray !

I believe the Problem is in the ToImport.txt file.  Can you mail please that file again on amor5143@aol.com.

Thanks.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #24 - Aug 17th, 2005 at 6:40pm
Print Post Print Post  
I'll be glad to send it to you again. Save it to the C:\Sesame folder and you should be good to go. It should be on it's way right now.

-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 #25 - Aug 18th, 2005 at 11:46am
Print Post Print Post  
Hello Ray!

Hier is the debug:


1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109


gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109

] #1
vData contains []
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109
] #2
Number of recs 0
5 Records in the subform
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109
] #1
vData contains []
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 0
7 Records in the subform
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains []
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 0
13 Records in the subform
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains []
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 0
3 Records in the subform
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #1
vData contains []
gsfile contains [
1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109] #2
Number of recs 0
10 Records in the subform


and Thanks again.

Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #26 - Aug 18th, 2005 at 1:32pm
Print Post Print Post  
Hello Dr Belhareth.

hmm that is odd. Hopefully this is the last set of debug.  Replace the code in the CustNum Mass Update event with the following code

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


SetStringArraySeparator(@Newline())
//Get all Data in the File for this Customer
vData = @SearchStringArray(gsFile, @Str(CustNum) + "..")

writeln("Searching for a customer number of [" + @Str(CustNum) + ".." + "]")

//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
} 



Run it and you should get five lines of debug. Post those lines here so I can see what is happening.

-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 #27 - Aug 18th, 2005 at 9:11pm
Print Post Print Post  
Hello Ray,

hier is the debug:

Searching for a customer number of [1,..]
Searching for a customer number of [2,..]
Searching for a customer number of [3,..]
Searching for a customer number of [4,..]
Searching for a customer number of [5,..]


Thanks.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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 #28 - Aug 19th, 2005 at 2:05pm
Print Post Print Post  
Hello Dr. Belhareth,

When you have a chance could you give the following code a run in the Mass update.

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


SetStringArraySeparator(@Newline())
//Get all Data in the File for this Customer
vData = @SearchStringArray(gsFile, @Str(@Int(CustNum)) + "..")

//You can remove these next two lines after everything is working fine
writeln("Searching for a customer number of [" + @Str(@Int(CustNum)) + ".." + "]")
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 #29 - Aug 19th, 2005 at 4:44pm
Print Post Print Post  
Hello Ray,

I think the chance is coming, hier is the entire debug :


1;Silver;1234
1;Plat;123.4
1;Iron;12.34
2;Tita;1
2;Alum;2
2;Plat;3
2;Silver;4
2;Gold;5
2;Ore;6
2;Iron;7
3;Silver;1
3;Iron;2
3;Tungsten;3
3;Alloy;4
3;Aluminum;5
3;Plat;6
3;Gold;7
3;Nickel;8
3;Tita;9
3;Steel;10
3;Stainless;11
3;Brass;12
3;Copper;13
4;Silver;1
4;Gold;2
4;Brass;3
4;Copper;4
5;Copper;100
5;Iron;101
5;Steel;102
5;Nickel;103
5;Brass;104
5;Gold;105
5;Silver;106
5;Alloy;107
5;Alum;108
5;Tita;109


Searching for a customer number of [1,..]
Length of vData 0
Searching for a customer number of [2,..]
Length of vData 0
Searching for a customer number of [3,..]
Length of vData 0
Searching for a customer number of [4,..]
Length of vData 0
Searching for a customer number of [5,..]
Length of vData 0

Thanks for your  feedback!
- Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
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