AW: Import from file on forms

Rudolf Bargholz rudolf at bargholz.ch
Mon Jul 25 06:35:30 UTC 2022


Hi Das,

Just make sure you clean up your data before parsing. I generally replace all con(kCr,kLf) with kCr and all kLf with kCr so that I have only one new line character to consider before taking apart the string. The strtok() function in Omnis will only allow you to parse on a single character if I recall correctly.

Regards

Rudolf

-----Ursprüngliche Nachricht-----
Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Das Goravani
Gesendet: Sonntag, 24. Juli 2022 19:36
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: Re: Import from file on forms


Dear Rudolf,

What a great idea.. just paste in from a spreadsheet !

I already implemented this in my app. I really thank you for the idea. 

I used stroke() to parse the data, I haven’t tested it, I hope it works, it relies on stroke() recognizing the kCr and kTab as token delimiters.

I put them in the function like this:  stroke('MyString',kCr) or kTab

I first grab a whole row with delimiter equal to kCr and then I parse that string using kTab as the delimiter. I think this is correct. 

One question is "Does it grab the LAST field from the kTab parsing" (does the last field also have a kTab after it and also then a kCr?)

Thanks

Das Goravani



> On Jul 24, 2022, at 9:54 AM, Rudolf Bargholz <rudolf at bargholz.ch> wrote:
> 
> Hi Das,
> 
> Generally, if a users selects a group of fields in Excel, and copies this data, the data will be copied as tab delimited text. Pasting this data into a Studio entry filed will paste the CR and TAB values as well. Taking apart this text is normally a pretty easy thing to do. The only issue you might have is with enclosed text that contains embedded LF (LineFeed) values in the respective cells. I use this sometimes as an easy way to get a not too large set of data into our app.
> 
> Regards
> 
> Rudolf Bargholz
> 
> -----Ursprüngliche Nachricht-----
> Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag 
> von Das Goravani
> Gesendet: Samstag, 23. Juli 2022 19:41
> An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Betreff: Import from file on forms
> 
> 
> I want to present to my users on forms, the ability to import a list of records.
> 
> The problem area for me is how to present the importation of the CSV or spreadsheet.
> 
> I know I can use the "File" component to upload to a binary field.  I would prefer this as it can be done on the client machine.
> 
> The problem is that File puts the file into a binary field. I need it in a list for importing. 
> 
> If you have a CSV or text spreadsheet in a binary field, can you move it to a list variable? With Calculate as… or something?
> 
> Or a more complex scenario whereby you convert it in a few steps?
> 
> Other than the "File" component approach, I could always have them put the CSV on the server and fetch it from there with regular import commands. 
> 
> I’m going to proceed to do it the server placed way.
> 
> If you have any input feel free to comment. 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com

_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


More information about the omnisdev-en mailing list