In FilemakerPro, one can update matching records whilst importing, selecting just the fields that you want to update.
How can this be done with Servoy?
In FilemakerPro, one can update matching records whilst importing, selecting just the fields that you want to update.
How can this be done with Servoy?
You could either use readTxtfile to read the text and loop through it yourself, or you could import into a temp table an loop through that.
Just our of curiosity: where did you use that fmp function for?
jaleman:
You could either use readTxtfile to read the text and loop through it yourself, or you could import into a temp table an loop through that.Just our of curiosity: where did you use that fmp function for?
It’s very useful, for instance, if you want to update a sales catalogue: old article’s prices are updated and new ones are added.
The function has been there for sometime.
I have a marketing db table of companies, which holds the latest revenue for each company, Each month we are given a new file from the client to update with the latest revenues and add new companies.
Could you provide an example of the loop please.
Thanks
Below is an example that reads a tab separated file into arrays that you can then use to do anything. replace \t with any other separator character if necessary.
var fileContents = application.readTXTFile() //if necessary you can put the full path there as well
//put each line into an array item
var fileLines = fileContents.split("\n");
//fileLines is now an array with 1 item per line
//now loop through the array to get to the cells
for ( var i = 0 ; i < fileLines.length ; i++ )
{
var cellsArray = fileLines[i].split("\t");
//your code that needs the data here, for example to read the first cell:
var theFirstCell = cellsArray[0]
}
I was having trouble with this myslef. Espescially when you have to import over 20000 records and run a loop to update all calculations. I have found the best way to import large record set from filemaker is to export the calculation fields as well. I usually export into XML, then import directly into your backend. This also has resolved some issues I had with large text fields that included tabs, date fields, etc. This is most likely not the most efficeint way.