Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi.

I have a CSV file that has dozens of lines that look much like this:

"first field a" ; "second field a" ; "third field a" ; 17 ;
"first field b" ; "second field b" ; "third field b" ; 26 ;

I have read this into a variable ($csvData) with the Files.ReadFile command - which seems to have worked OK.
I then want to import these entries into a table with the FM.InsertRecordCSV command, but it is giving me grief.

MBS("FM.InsertRecordCSV" ; "Solution.fmp12" ; "Part_List" ; "Product_Code¶Description¶Brand¶SOH" ; Char(59) ; $csvData)

It reports the following:  "[MBS] CSV has 2 columns, but we have 4 field names"
It seems to have seen the four field names OK. The first three are text fields, the last is a number - in case this makes a difference.

Given that Char(59) is the semicolon, and I have also put the semicolon in quotes there instead as a test, why does MBS see only 2 columns in that data?
(Oddly enough, as a test, I replaced the semicolons with a pipe symbol (Char(124)) and then it reported that the CSV only had one column. That confused me even more.)
I get the same result if I use the data directly from the CSV file in a container as opposed to a variable.

Can anybody suggest please what I may be doing wrong here?

Many thanks in advance,
Greg

 

Just curious why you cannot simply import the file using Filemaker's native Import Records command/script step.

 

Your CSV is really with spaces after the quote? that seems strange to me.

 

And I think you swapped parameters: Char(59) ; $csvData

 

MBS( "FM.InsertRecordCSV"; InsertFileName; InsertTableName; FieldNames; Text { ; Delimiter; FieldName...; FieldValue... } )

 

  • Author

Hi Comment.

Thanks for your reply. 

The error was mine and I have resolved it.  The native one works for me as well now.

Thankyou.
Greg

Hi Christian,

Duh.  Indeed, I had the delimiter and the data back to front.
Sorry, and thankyou. :)

Greg

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.