Normal Topic Leading and trailing blanks (Read 620 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Leading and trailing blanks
Jan 1st, 2012 at 11:54pm
Print Post Print Post  
Hello all,

I'm looking for a small quirk I have run into. 

I have a background calculated TEXT field with about 200 lines of code to create a fixed set of alphanumeric data to export later.  The problem is the data has leading and trailing blanks at some points.  When I update the field, it truncates the leading and trailing blank data from the results of the code.

How can I override this to ensure the field includes all my data?

Thanks!
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Leading and trailing blanks
Reply #1 - Jan 2nd, 2012 at 2:03am
Print Post Print Post  
Do you need to store the string in a field? If it persists only as long as the form is open, you can use a global variable. If it must persist while the client is open, even if the form closes, you can use client-local storage. If it must persist between client runs, or even server runs, you can use the server based storage of GlobalValue. If it must persists between server runs and is associated with more than one client or application, you can use temporary file storage. If it absolutely must be stored in a record, you might try using one of the XResultSet family of commands, in that it is likely that it is the form element (not the field) that is stripping the blanks.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Leading and trailing blanks
Reply #2 - Jan 2nd, 2012 at 2:34am
Print Post Print Post  
Well, I'm storing a fixed ASCII line of 511 characters for each record, that can have changes each time the record is altered, and to built that 511 characters, I have written 220 lines of code and created a number of variables to calculate on form exit.

My original plan was to have these calculate on the fly as the files are worked, and then once a month export them into a flat ASCII file as a report.  This export could be 15,000 records each month...

The field I'm using to create the data is a text field.  When I use WriteLn, my data comes out unstripped.  When I update the field, it briefly appears unstripped in the field, and then truncates it.  Is there some sort of text field setting to avoid truncation of 'extraneous' blanks?

Other than that, would you recommend a better method than what I'm trying, in specific?
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Leading and trailing blanks
Reply #3 - Jan 2nd, 2012 at 4:37am
Print Post Print Post  
Text elements want to strip leading and trailing blanks. I believe that that happens at the element level, not the field level. Since you intend for them to persist, I'd recommend using a server based approach. So, either use a field and address it with XResultSet commands, or use a set of GlobalValues, one for each record, naming them so that they are unique to that record.

If this is some sort of ongoing log, you may be better served by saving it in real-time, rather than accumulating it. The only reason I can see for saving an ongoing log to a record is if that is its final destination.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: Leading and trailing blanks
Reply #4 - Jan 3rd, 2012 at 4:15pm
Print Post Print Post  
Hello Blair,

One other thing you can do since you mean to export it later is end and finish the field with a " character. You can always strip the " character when you do the export as long as you are the one writing out the file using programming.

-Ray
  

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