Trust ID PBCEX logo 300x102

Write data to CSV file from SQL View table?

6 years 1 week ago
David Stewart
Fresh Boarder
Fresh Boarder
Posts: 3
More
Topic Author
Write data to CSV file from SQL View table? #6014
Hi,

When printing a card I need to write data to a csv file for importing to our security database. The data I need is stored in 2 primary MS SQL Server tables. I think I originally tried getting the data from the 2 primary tables but couldn't get that to work so I created a View table in the source SQL database, but when I configure CardExchange to output to the csv file I get the following error:

'Error while printing the card.
Error while printing the card.
Could not write data to [Cardexchange#csv].
Updating data in a linked table is not supported by this ISAM.'

Any ideas?
6 years 1 week ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
Write data to CSV file from SQL View table? #6015
Hi David,

Storage items can only ass new record to CSV file, but not update existing ones. So you will get this error when printing a record that already exists in the CSV file. In the Advanced options of the storage-item definition (database-setup) there is an option "Always insert". This makes sure that whenever you print, CardExchange adds a new record to the CSV file. The primary key will not be unique anymore in the CSV file though, and the import procedure must be able to handle that.

To avoid any problems related to using CSV files is having CardExchange write directly to the target database of the security system. the database could have for example, a special table CardExchange can write to and that the system reads to import the data in the other tables. You could also write the storage items to Excel or Access and then create the CSV file using these products.

regards,
Rutger.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
The following user(s) said Thank You David Stewart
6 years 1 week ago
David Stewart
Fresh Boarder
Fresh Boarder
Posts: 3
More
Topic Author
Write data to CSV file from SQL View table? #6017
Thanks, yep, that's the answer, problems with re-installing software and forgetting the previous settings, works well adding to the csv file and does retrieve data from the View table perfectly. Thanks again :)