Re: Using Document to text ala Receive Packet Was: Receive packet stop character

2020-04-24 Thread JOHN BAUGHMAN via 4D_Tech
I have modified my Document to text wrapper that functions like Receive packet. 
Not sure if anyone is really interested in this but since I did post the 
original method I thought it best for me to post the modified version.

The new version has 2 uses..

1. To replace Receive packet as it was used in a loop to receive the 
contents of a document 1 row at a time.
2. To load the contents of a document with a specified EOL character 
regardless of platform, with or without an existing header row

Also changed is the requirement to pass the break mode parameter (EOL) when 
using as a replacement for Receive Packet. Only the first 2 parameters are now 
passed.

I hope someone finds this useful.

John

 // Method: ReceivePacket_DocToText 
(->pathToDocumentVariable;->VariableToHoldDocContents{;BreakMode}{;RemoveTopRows})->
 rowText | {header text | document text}
  // 
  // Created by: John Baughman
  // Date and time: 34/23/20,  1:05 PM
  // 
  // Description
  //   Replacement for Receive Packet using Document To Text
  // Parameters
C_POINTER($1;$pathPtr)  //$1 is a pointer to the variable holding the path to 
the document. 
  //In a repeat loop you can put an empty string in the variable to allow the 
user to pick the document using Document Select.
  //The variable will be updated to contain the chosen path which will prevent 
the document from being loaded again 
  //If the user cancels the Select Document, $rowText:="", and 
$documentTextPtr->:=""
C_POINTER($2;$documentTextPtr)  //Pass an empty text variable in the first call 
and it will be loaded from the document with Document to text.
  //subsequent calls will not reload the document as the variable will no 
longer be empty. Instead the wrapper will use this variable as passed in ($2)
  //The variable will be loaded with the document contents minus the row being 
returned.
C_TEXT($0;$rowText)  //$RowText will hold the first row in the $DocumentTextPtr 
variable and returned in $0. 
  //The first row in the $DocumentTextPtr variable wil be removed.
  //If you pass more than 2 parameters $0 will be the document contents or 
removed top rows as explained in the following parameters

  //The following parameters are used only if you just want the contents of the 
document. DO NOT USE IN A LOOP
C_LONGINT($3;$breakMode)  //Document to Text will convert the EOL character in 
the document to the passed desired break mode constants...
  //Document with CR
  //Document with CRLF
  //Document with LF
  //Document with native format
C_LONGINT($4;$removeTopRowscount)  //The number of top rows to be removed from 
the returned contents. 
  //The document contents with or without top rows removed will be returned in 
the $documentTextPtr variable ($2)
  //The removed lines will be returned in $0
  //If you want the whole document pass 0 in $4. In the case both $0 and the 
$documentTextPtr variable ($2) will contain the whole document
  //The EOL character(s) will be the requested characters as passed in $3


If (False)  //Example Calls
//With regard to EOL characters, the following examples will work on 
both Mac and Windows platforms

  //---
  //To replace Recieve Packet getting each row one at a time in a loop
C_TEXT($TextValue;$path)
$TextValue:=""
$path:=""
Repeat 
$row:=ReceivePacket_DocToText (->$path;->$TextValue)
  //handle the row
Until (ok=0)


  //---
  //To get the whole document contents with CRs as the EOL characters
C_TEXT($TextValue;$path)
$DocumentText:=""
$path:=""
$DocumentText:=ReceivePacket_DocToText 
(->$path;->$DocumentText;Document with CR;0)  //Get the whole document
  //$DocumentText = whole document with CRs including a header row if 
it exists
  //Note: In this context $2 can be a nill pointer

  //---
  //To get the document contents WITHOUT the header row, with CRs as 
the EOL characters
C_TEXT($TextValue;$path)
$DocumentText:=""
$path:=""
$removedRows:=ReceivePacket_DocToText (->$path;->$DocumentText;Document 
with CR;1)  //Get the whole document without the header row. To remove 1 top 
rows, pass 1, for 2 rows pass 2, etc.
  //$romovedRows is the header row and $DocumentText contains the 
document content without the header row, both with CRs

End if 



  // 

$pathPtr:=$1
$DocumentTextPtr:=$2


If (Is nil pointer($2))
$documentText:=""
$DocumentTextPtr:=->$documentText

End if 



If (Count parameters=2)
$breakMode:=Document with CR //The wrapper will always use CR for 
Recieve packet functionality

Else 
//Document text with EOL characters is being requested
$breakMode:=$3
$remov

Re: Using Document to text ala Receive Packet Was: Receive packet stop character

2020-04-23 Thread Chip Scheide via 4D_Tech
John,
unless you are reading data from a stream - 
why don't you just read the entire document into memory, THEN parse it?

every reference to the document (on disk) will take longer - by a factor of up 
to 1000 - than referencing the same information from memory. (spinning disks 
access in milliseconds, memory in nano seconds, SSDs are in between).

so read the entire document -
examine the text until you find a CR, LF or combination - 
if you find one check the next and/or previous character for the other.
now you know your EOL. 
You can not depend on the platform for the EOL determination.
A File created on a Mac can be read on a PC and vise verse.

if you need to process 1 'line' at a time just step through the text ending on 
the EOL from above.
you can check the size of the text, or the counter/pointer into your text 
(depending on your processing method) to determine if yo have processed 
everything.

something like this (assumes document in text var):
Last_Char_Counter:=0
repeat
local_text := get_text_to_next_EOL(TextVar; -> Last_Char_Counter)
if (local_text #"")
process text
end if
until (length(local_text) < 5) | (Last_Char_Counter + 5>=length(TextVar))

5 is to account for various extra characters I have often found at the end of 
documents, like multiple Cr/CrLf etc, YMMV on this number or it's need.

Chip


>> On Mar 25, 2020, at 8:21 PM, Keisuke Miyako via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> sometimes, it might just be easier to read the entire text with
>> 
>> Document to text (which can normalise the EOL character)
> 
> I took Keisuke’s advice to heart and looked closer at Document to 
> text. I did not realize that it provided a means to handle any EOL 
> confusion between Mac and Windows. For me this makes the use of 
> Document to text a much better way to read the contents of a document 
> by row than Receive packet. 
> 
>  In an effort to duplicate Receive packet’s functionality when used 
> in a repeat loop to get rows of a tab delimited text document, I 
> created a wrapper method as a replacement for Receive packet.
> 
> I am posting this method here in the event someone on on the NUG 
> might find it useful. More importantly for me, however, perhaps to 
> get some feedback with regard to anything I may have overlooked or 
> anything I may need to do to clean it up.
> 
> It was written in a v14 database so does not use any of the newer 
> features in v17 and later like Is Windows and/or objects.
> 
>  Thanks for any feedback.
> 
> John
> 
> 
> --
> 
>   // Method: ReceivePacket_DocToText 
> (->pathToDocumentVariable;->VariableToHoldDocContents;BreakMode)
>   // 
>   // Created by: John Baughman
>   // 
>   // Description
>   //Replacement for Receive Packet using Document To Text
> 
>   // Parameters
> C_POINTER($1;$pathPtr)  //$1 is a pointer to the variable holding the 
> path to the document. 
>   //In a repeat loop you can put an empty string in the variable to 
> allow the user to pick the document using Document Select.
>   //The variable will be updated to contain the chosen path for 
> subsequent calls for rows in the loop. 
>   //If the user cancels the Select Document, $rowText:="", and 
> $documentTextPtr->:=“"
> 
> C_POINTER($2;$documentTextPtr)  //Pass an empty text variable in the 
> first call and it will be loaded from the document with Document to 
> text.
>   //The variable will be loaded with the document contents minus the 
> row being returned.
> 
> C_TEXT($0;$rowText)  //$RowText will hold the first row in the 
> $DocumentTextPtr variable and returned in $0. 
>   //The first row in the $DocumentTextPtr variable wil be removed.
> 
> C_LONGINT($3;$breakMode)  //Document to Text will convert the EOL 
> character to the following desired break mode constants...
>   //Document with CR
>   //Document with CRLF
>   //Document with LF
>   //Document with native format
> 
>   //Example Call
> If (False)
>   C_TEXT($TextValue;$path)
>   $TextValue:=""
>   $path:=""
>   Repeat 
> $rowText:=ReceivePacket_DocToText (->$path;->$TextValue;Document 
> with CR)
>//If TextValue is “” then the text will be loaded from the 
> document and returned minus the first row in TextValue
>//Subsequent calls will return first row in $rowText and return the 
> text minus the first row in TextValue.
>   If (rowText#””)
>  //handle the row
>   End if
>   Until (TextValue =“")   //note: I do not use the ok variable as I 
> found that the ok variable may get set incorrectly by 4D if the last 
> row does not have CR.
> 
> End if 
> 
>   // 
> 
> $pathPtr:=$1
> $DocumentTextPtr:=$2
> $breakMode:=$3
> $rowText:=""
> 
> If ($pathPtr->="")
> //They want to select the document
>   ARRAY TEXT($aSelected;0)
>   $path:=

Using Document to text ala Receive Packet Was: Receive packet stop character

2020-04-23 Thread JOHN BAUGHMAN via 4D_Tech
> On Mar 25, 2020, at 8:21 PM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> sometimes, it might just be easier to read the entire text with
> 
> Document to text (which can normalise the EOL character)

I took Keisuke’s advice to heart and looked closer at Document to text. I did 
not realize that it provided a means to handle any EOL confusion between Mac 
and Windows. For me this makes the use of Document to text a much better way to 
read the contents of a document by row than Receive packet. 

 In an effort to duplicate Receive packet’s functionality when used in a repeat 
loop to get rows of a tab delimited text document, I created a wrapper method 
as a replacement for Receive packet.

I am posting this method here in the event someone on on the NUG might find it 
useful. More importantly for me, however, perhaps to get some feedback with 
regard to anything I may have overlooked or anything I may need to do to clean 
it up.

It was written in a v14 database so does not use any of the newer features in 
v17 and later like Is Windows and/or objects.

 Thanks for any feedback.

John


--

  // Method: ReceivePacket_DocToText 
(->pathToDocumentVariable;->VariableToHoldDocContents;BreakMode)
  // 
  // Created by: John Baughman
  // 
  // Description
  //Replacement for Receive Packet using Document To Text

  // Parameters
C_POINTER($1;$pathPtr)  //$1 is a pointer to the variable holding the path to 
the document. 
  //In a repeat loop you can put an empty string in the variable to allow the 
user to pick the document using Document Select.
  //The variable will be updated to contain the chosen path for subsequent 
calls for rows in the loop. 
  //If the user cancels the Select Document, $rowText:="", and 
$documentTextPtr->:=“"

C_POINTER($2;$documentTextPtr)  //Pass an empty text variable in the first call 
and it will be loaded from the document with Document to text.
  //The variable will be loaded with the document contents minus the row being 
returned.

C_TEXT($0;$rowText)  //$RowText will hold the first row in the $DocumentTextPtr 
variable and returned in $0. 
  //The first row in the $DocumentTextPtr variable wil be removed.

C_LONGINT($3;$breakMode)  //Document to Text will convert the EOL character to 
the following desired break mode constants...
  //Document with CR
  //Document with CRLF
  //Document with LF
  //Document with native format

  //Example Call
If (False)
  C_TEXT($TextValue;$path)
  $TextValue:=""
  $path:=""
  Repeat 
$rowText:=ReceivePacket_DocToText (->$path;->$TextValue;Document with CR)
 //If TextValue is “” then the text will be loaded from the document 
and returned minus the first row in TextValue
 //Subsequent calls will return first row in $rowText and return the 
text minus the first row in TextValue.
  If (rowText#””)
 //handle the row
  End if
  Until (TextValue =“")   //note: I do not use the ok variable as I found that 
the ok variable may get set incorrectly by 4D if the last row does not have CR.

End if 

  // 

$pathPtr:=$1
$DocumentTextPtr:=$2
$breakMode:=$3
$rowText:=""

If ($pathPtr->="")
  //They want to select the document
ARRAY TEXT($aSelected;0)
$path:=Select document("";"*";"";0;$aSelected)

If (ok=1)
$pathPtr->:=$aSelected{1}

End if 

End if 

If (ok=1)

If ($DocumentTextPtr->="")
  //Document has not yet been loaded
If (Is Windows)
$documentTextPtr->:=Document to 
text($pathPtr->;"ANSI_X3.4-1986";$breakMode)
$stopCharacter:="\r\n"

Else 
$documentTextPtr->:=Document to 
text($pathPtr->;"MacRoman";$breakMode)
$stopCharacter:="\r"

End if 

   //else document has been loaded use text in DocumentTextPtr

End if 

$found:=False

Case of 

: ($breakMode=Document with CR)
$stopCharacter:="\r"

: ($breakMode=Document with LF)
$stopCharacter:="\n"

: ($breakMode=Document with CRLF)
$stopCharacter:="\r\n"

  //else
  //$stopCharacter was set to the default for the 
platform above following document to text

End case 


If (Position($stopCharacter;$DocumentTextPtr->)=0)
  //Assumes that this is the last row without an EOL

Re: Receive packet stop character

2020-03-26 Thread Randy Kaempen via 4D_Tech
John,

This doesn’t answer your question, but there are other special cases as well.  
Even if you’re using a carriage return as the end-of-line, you could have it 
inside some of your data, if the text has quotes around it.  Many CSV files are 
like this.  In that case, you need to process character at a time to see if 
you’re inside of quotes or not.  If you are, then the carriage return is just 
more of the data for the field.  If you are not inside quotes, then it acts as 
the record delimiter.  That can cause lines to truncate early if you’re just 
doing:

RECEIVE PACKET($DocRef;$TextValue;Char(13))

Sorry to be a downer, but I’ve run into all sorts of exceptions doing imports.


Randy Kaempen
Intellex Corporation



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Keisuke Miyako via 4D_Tech
sometimes, it might just be easier to read the entire text with

Document to text (which can normalise the EOL character)

and process the text afterwards with Match regex or Position.

2020/03/26 13:51、Chip Scheide via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
it is too late here to dig up the code...

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread JOHN BAUGHMAN via 4D_Tech
Thanks to all who responded. I am really confused now. Turns out the problem 
was in fact what I suspected all along… the end of row delimiter was a line 
feed and not a carriage return. 

This begs a few questions …

Why did this change all of a sudden. I had been working with the same 
text document for most of the day and it was working fine. This is an old 
project and I have never had an issue with this particular section of cade 
before.

On a Mac doesn’t TextEdit use carriage returns? It has always done so 
for me in the past. If I hit the return key on my keyboard it should be a 
carriage return. As soon as I saw this problem earlier today, I re-typed all 
the paragraph endings with a return using the return key on my keyboard in 
TextEdit. In the past if there was a line feed in the document it always showed 
up as a blank character. In other words, back space the carriage return and you 
had to backspace one more time to get to the end of the paragraph.

No need to respond. I knew what the problem most likely was before I 
sent my first message. Thanks to Spencer Hinsdale for suggesting to use USE 
CHARACTER SET("iso-8859-1";1). It revealed the \n in the returned package. 
Otherwise I would have continued to chase my tail on this one.

John




>> On Mar 25, 2020, at 8:10 PM, Spencer Hinsdale via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> 
>> Does the behavior change if you insert
>> USE CHARACTER SET("iso-8859-1";1)
>> before receive packet
>> 
>> 
>> On 3/25/20, 8:01 PM, "4D_Tech on behalf of JOHN BAUGHMAN via 4D_Tech" 
>> <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote:
>> 
>>> On Mar 25, 2020, at 3:54 PM, Jeffrey Kain via 4D_Tech 
>>> <4d_tech@lists.4d.com> wrote:
>>> 
>>> You've got a smart quote in there... email post typo or is it in your code?
>> 
>>  Actually I typed that in while drafting the email. This is old code 
>> that has worked for years. I also tried changing the code to char(carriage 
>> return)
>> 
>> 
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> _
> Bob McKeever  http://www.mswl.com 
> McKeever's Software Wizardry
> Port Coquitlam, B.C.
> bobmckee...@mac.com
> 
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Chip Scheide via 4D_Tech
John,
you probably should not be reading individual lines of data from the disk.  
This takes mach more time...

it is too late here to dig up the code... but here is an outline of a better 
(best?) way to deal with text files:

Read_File_to_Text_Array
`$1 - pointer - to text array
`$2 - time - document reference

Repeat 
insert element into array
receive packet($DocRef; $Array_ptr->{$counter}; 300megs)
if (last character is not EOL)
receive until EOL
until end of file

NOTES:
- you can check for what EOL character is by examining the first text array 
element looking for whatever EOL marker you expect
- this in most cases reads the entire text file into a single text array element
- 300 megs was an empirically determined number (v13) where 4D was OK with 
reading and managing too much larger and 4D got/gets unhappy
- the test for EOL in the repeat loop is to allow each text array element to 
end on the end of 1 line of data - to avoid breaking a line across 2 text 
elements
- this works for any size file
- it makes processing the imported data much faster - as everything is in 
memory rather then reading from disk each line.
- if you do not have one written already, a text parser which keeps a numeric 
counter as to where it left off is very fast an efficient for moving through 
text data

if you need code for either the file reading or text parsing let me know I will 
get it you.

Chip




> I have a tab delimited text file and I want to get the first row with…
> 
> C_TEXT($TextValue)
> $DocRef:=Open document($IndexPath)
> RECEIVE PACKET($DocRef;$TextValue;”\r")
> CLOSE DOCUMENT($DocRef)
> 
> This was working fine until about an hour ago when it suddenly 
> started bringing in the whole document which has many rows. Using “\t
> ” works fine just bringing the first field in the first row.
> Any ideas?
> 
> Mac OS High Sierra
> 4D v14 in Unicode mode
> 
> John
> 
> 
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Chip Scheide via 4D_Tech
John,
try:

RECEIVE PACKET($DocRef;$TextValue;Char(13)) //return
or
RECEIVE PACKET($DocRef;$TextValue;Char(10)) // line feed
or
RECEIVE PACKET($DocRef;$TextValue;Char(13)+Char(10)) // both of the above

depending on how much control you have on the incoming file it could be any 
combination
my preferred way is:
$EOL := Test_EOL($DocRef)
if ($EOL #"")
RECEIVE PACKET($DocRef;$TextValue;$EOL)
`do stuff

below written in email so...

Test_EOL
`$1 - time - document reference
`RETURNS - text - EOL character or empty string if none found

c_time($1;$DocRef)
c_text($TextValue;Return;$0)
c_boolean($EOF)

$DocRef := $1

Repeat
RECEIVE PACKET($DocRef;$TextValue;100) 
case of
: (position(char(13)+char(10),$TextValue) >0)
$return := char(13)+char(10)
: (position(char(13),$TextValue) >0)
$return := char(13)
: (position(char(10),$TextValue) >0)
$return := char(10)
:(OK = 0)
$EOF:=true
end case
until ($return#"") | ($EOF)
`I forget the command - but reset read point in file to start
`end


> I have a tab delimited text file and I want to get the first row with…
> 
> C_TEXT($TextValue)
> $DocRef:=Open document($IndexPath)
> RECEIVE PACKET($DocRef;$TextValue;”\r")
> CLOSE DOCUMENT($DocRef)
> 
> This was working fine until about an hour ago when it suddenly 
> started bringing in the whole document which has many rows. Using “\t
> ” works fine just bringing the first field in the first row.
> Any ideas?
> 
> Mac OS High Sierra
> 4D v14 in Unicode mode
> 
> John
> 
> 
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Robert McKeever via 4D_Tech
So, open the file with a hex editor, and see what ends the first line. I use 
Hex Fiend for that on the Mac.

> On Mar 25, 2020, at 8:10 PM, Spencer Hinsdale via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> 
> Does the behavior change if you insert
> USE CHARACTER SET("iso-8859-1";1)
> before receive packet
> 
> 
> On 3/25/20, 8:01 PM, "4D_Tech on behalf of JOHN BAUGHMAN via 4D_Tech" 
> <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote:
> 
>> On Mar 25, 2020, at 3:54 PM, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> You've got a smart quote in there... email post typo or is it in your code?
> 
>   Actually I typed that in while drafting the email. This is old code 
> that has worked for years. I also tried changing the code to char(carriage 
> return)
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

_
Bob McKeever  http://www.mswl.com 
McKeever's Software Wizardry
Port Coquitlam, B.C.
bobmckee...@mac.com




**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Spencer Hinsdale via 4D_Tech

Does the behavior change if you insert
USE CHARACTER SET("iso-8859-1";1)
before receive packet


On 3/25/20, 8:01 PM, "4D_Tech on behalf of JOHN BAUGHMAN via 4D_Tech" 
<4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote:

> On Mar 25, 2020, at 3:54 PM, Jeffrey Kain via 4D_Tech 
<4d_tech@lists.4d.com> wrote:
> 
> You've got a smart quote in there... email post typo or is it in your 
code?

Actually I typed that in while drafting the email. This is old code 
that has worked for years. I also tried changing the code to char(carriage 
return)



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread JOHN BAUGHMAN via 4D_Tech
> On Mar 25, 2020, at 3:54 PM, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> You've got a smart quote in there... email post typo or is it in your code?

Actually I typed that in while drafting the email. This is old code 
that has worked for years. I also tried changing the code to char(carriage 
return)

> Could the line ending have change to something else like \n ?

No. See my response to Chuck.

John


> 
>> On Mar 25, 2020, at 9:31 PM, JOHN BAUGHMAN via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I have a tab delimited text file and I want to get the first row with…
>> 
>> C_TEXT($TextValue)
>> $DocRef:=Open document($IndexPath)
>> RECEIVE PACKET($DocRef;$TextValue;”\r")
>> CLOSE DOCUMENT($DocRef)
>> 
>> This was working fine until about an hour ago when it suddenly started 
>> bringing in the whole document which has many rows. Using “\t” works fine 
>> just bringing the first field in the first row.
>> Any ideas?
>> 
>> Mac OS High Sierra
>> 4D v14 in Unicode mode
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread JOHN BAUGHMAN via 4D_Tech

> On Mar 25, 2020, at 4:46 PM, Charles Miller via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Perhaps it is a new line

Trying to figure out what was wrong I went into the text file with TextEdit and 
deleted each return making sure that there was no other hidden characters in 
there and reinserted the return with the return key. I also opened it up in 
Pages and showing invisibles all were carriage returns I also brought in other 
text files that have worked fine up to now and it did not work with them either.


> 
> On Wed, Mar 25, 2020 at 9:31 PM JOHN BAUGHMAN via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> I have a tab delimited text file and I want to get the first row with…
>> 
>> C_TEXT($TextValue)
>> $DocRef:=Open document($IndexPath)
>> RECEIVE PACKET($DocRef;$TextValue;”\r")
>> CLOSE DOCUMENT($DocRef)
>> 
>> This was working fine until about an hour ago when it suddenly started
>> bringing in the whole document which has many rows. Using “\t” works fine
>> just bringing the first field in the first row.
>> Any ideas?
>> 
>> Mac OS High Sierra
>> 4D v14 in Unicode mode
>> 
>> John
>> 
>> 
>> John Baughman
>> Kailua, Hawaii
>> (808) 262-0328
>> john...@hawaii.rr.com
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> -- 
> -
> Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
> Informed Solutions, Inc.
> Brookline, MA 02446 USA Registered 4D Developer
>   Providers of 4D, Sybase & SQL Server connectivity
>  https://www.informed-solutions.com
> -
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption from
> disclosure as to this communication.
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Charles Miller via 4D_Tech
Perhaps it is a new line

On Wed, Mar 25, 2020 at 9:31 PM JOHN BAUGHMAN via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I have a tab delimited text file and I want to get the first row with…
>
> C_TEXT($TextValue)
> $DocRef:=Open document($IndexPath)
> RECEIVE PACKET($DocRef;$TextValue;”\r")
> CLOSE DOCUMENT($DocRef)
>
> This was working fine until about an hour ago when it suddenly started
> bringing in the whole document which has many rows. Using “\t” works fine
> just bringing the first field in the first row.
> Any ideas?
>
> Mac OS High Sierra
> 4D v14 in Unicode mode
>
> John
>
>
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server connectivity
  https://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption from
disclosure as to this communication.
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Receive packet stop character

2020-03-25 Thread Jeffrey Kain via 4D_Tech
You've got a smart quote in there... email post typo or is it in your code?

Could the line ending have change to something else like \n ?

> On Mar 25, 2020, at 9:31 PM, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I have a tab delimited text file and I want to get the first row with…
> 
> C_TEXT($TextValue)
> $DocRef:=Open document($IndexPath)
> RECEIVE PACKET($DocRef;$TextValue;”\r")
> CLOSE DOCUMENT($DocRef)
> 
> This was working fine until about an hour ago when it suddenly started 
> bringing in the whole document which has many rows. Using “\t” works fine 
> just bringing the first field in the first row.
> Any ideas?
> 
> Mac OS High Sierra
> 4D v14 in Unicode mode

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Receive packet stop character

2020-03-25 Thread JOHN BAUGHMAN via 4D_Tech
I have a tab delimited text file and I want to get the first row with…

C_TEXT($TextValue)
$DocRef:=Open document($IndexPath)
RECEIVE PACKET($DocRef;$TextValue;”\r")
CLOSE DOCUMENT($DocRef)

This was working fine until about an hour ago when it suddenly started bringing 
in the whole document which has many rows. Using “\t” works fine just bringing 
the first field in the first row.
Any ideas?

Mac OS High Sierra
4D v14 in Unicode mode

John


John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**