Normal Topic @FormResultSetCurrentPosition (Read 493 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
@FormResultSetCurrentPosition
Jan 2nd, 2014 at 9:57pm
Print Post Print Post  
Hi all,

I'm trying to build a mass update to take a current set of records and export them to a text file. 

However, I've put in coding to tell the system when it's on the first record to write the header line, but ignore it for further records ... but it's repeating the header.  When I use Writeln to check my @formresultsetcurrentposition, it counts off correctly.  Can you see why this isn't working?

Code
Select All
vHeaderDate = @right(("0" + @dom(@date)),2) + "/" + @left(@month$(@date),3) + "/" + @YEAR(@date)

vDataPath = "c:\sesame2\data\padexport\KNG_" + @right(("0" + @dom(vHeaderDate)),2) + @left(@month$(vHeaderdate),3) + @year(vHeaderdate) + ".txt"

vHeader = "HDR" + @right(("0" + @dom(@date)),2) + "/" + @right(("0" + @month(@date)),2) + "/" + @year(@Date) + @newline()

FileDelete(vDataPath)

vFileHandle = FileOpen(vDataPath)
FileSeek(vDataPath, 0)

if @FormResultSetCurrentPosition("Pmt Admin Screen") = 1 then FileWrite (vFileHandle,vHeader)

vDataLine = (LOTS OF CODE)

FileWrite(vFileHandle,vDataLine)
FileWrite(vFileHandle,@newline())

FileClose(vFileHandle)
 

  
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: @FormResultSetCurrentPosition
Reply #1 - Jan 3rd, 2014 at 5:40pm
Print Post Print Post  
Hello Blair,

I am not seeing how the header keeps reappearing in the text file nor do I see how you are getting more than one record in the text file as you are deleting it on every record with the
Code
Select All
FileDelete(vDataPath) 


line. I would recommend opening the file and writing the header in Global Code, Taking out the FileDelete() call and see where that puts you.

-Ray
  

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



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: @FormResultSetCurrentPosition
Reply #2 - Jan 3rd, 2014 at 6:26pm
Print Post Print Post  
That did it ... thanks Ray!
  
Back to top
IP Logged