Re: Counting occurrences of specific characters In a document
Maybe this will help: http://kb.4d.com/assetid=76822 // UTIL_HowMany C_TEXT($1) // input C_TEXT($2) // count this C_LONGINT($0) If (Count parameters=2) $0:=(Length($1)-(Length(Replace string($1;$2;""/Length($2) Else $0:=0 End if Once the project method is saved as UTIL_HowMany it can be used like this: $a:="test, test, test" $b:="," $num:=UTIL_HowMany($a;$b) From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> Sent: Wednesday, November 8, 2017 9:17:02 PM To: 4d_tech@lists.4d.com Cc: Chip Scheide Subject: Re: Counting occurrences of specific characters In a document a cheat.. you will create 2 copies of the data. $Start_size := length(Imported_Text) $Removed:=replace string(Imported_Text;Char(13)) $Removed_Size:=$Start_Size - Length($Removed) $Removed_Size = number of characters (returns) replaced > Thank you Cannon, > > Progress indicator is not the only reason we need to know number of > rows in advance. However, your suggestion for using parse position > and file size for process bars is intriguing and new to me. I will > investigate. > > Kirk > >> On Nov 8, 2017, at 7:11 PM, Cannon Smith via 4D_Tech >> <4d_tech@lists.4d.com> wrote: >> >> If the only reason you need to know the number of rows beforehand is >> to help in showing a progress indicator, you could use the file size >> and current parse position instead >> >> -- >> Cannon Smith >> >>> On Nov 8, 2017, at 6:42 PM, rooftop99--- via 4D_Tech >>> <4d_tech@lists.4d.com> wrote: >>> >>> We are working with large Excel documents which contain upwards of >>> 750K rows and we need to import each row into a 4D application to >>> create records. In advance of the import process I would like to >>> know how may rows to expect. >> >> ** >> 4D Internet Users Group (4D iNUG) >> FAQ: http://lists.4d.com/faqnug.html >> Archive: http://lists.4d.com/archives.html >> Options: http://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ** > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://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) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Counting occurrences of specific characters In a document
a cheat.. you will create 2 copies of the data. $Start_size := length(Imported_Text) $Removed:=replace string(Imported_Text;Char(13)) $Removed_Size:=$Start_Size - Length($Removed) $Removed_Size = number of characters (returns) replaced > Thank you Cannon, > > Progress indicator is not the only reason we need to know number of > rows in advance. However, your suggestion for using parse position > and file size for process bars is intriguing and new to me. I will > investigate. > > Kirk > >> On Nov 8, 2017, at 7:11 PM, Cannon Smith via 4D_Tech >> <4d_tech@lists.4d.com> wrote: >> >> If the only reason you need to know the number of rows beforehand is >> to help in showing a progress indicator, you could use the file size >> and current parse position instead >> >> -- >> Cannon Smith >> >>> On Nov 8, 2017, at 6:42 PM, rooftop99--- via 4D_Tech >>> <4d_tech@lists.4d.com> wrote: >>> >>> We are working with large Excel documents which contain upwards of >>> 750K rows and we need to import each row into a 4D application to >>> create records. In advance of the import process I would like to >>> know how may rows to expect. >> >> ** >> 4D Internet Users Group (4D iNUG) >> FAQ: http://lists.4d.com/faqnug.html >> Archive: http://lists.4d.com/archives.html >> Options: http://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ** > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://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) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Counting occurrences of specific characters In a document
sounds like you are mainly interested in text data. you could try https://github.com/miyako/4d-plugin-xlsxio which converts XLSX to JSON. for XLS this might work https://github.com/miyako/4d-plugin-free-xl miyako ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Counting occurrences of specific characters In a document
If the only reason you need to know the number of rows beforehand is to help in showing a progress indicator, you could use the file size and current parse position instead -- Cannon Smith > On Nov 8, 2017, at 6:42 PM, rooftop99--- via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > We are working with large Excel documents which contain upwards of 750K rows > and we need to import each row into a 4D application to create records. In > advance of the import process I would like to know how may rows to expect. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **