www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Good way let low-skill people edit CSV files with predefined row

reply Dukc <ajieskola gmail.com> writes:
We're planning to have our product preview program to calculate 
and suggest a price for the product displayed. There are a lot of 
variables to take into account, so it's essential the users can 
edit the price variables themselves.

The problem is that many of them are not the best computer users 
around, even by non-programmer standards. I'd like the price 
variable file to be in CSV format, so I don't have to go looking 
for a new file parser (the preview program is mostly compiled to 

the mix). I know I can tell the users to use spreadsheet programs 
to edit CSV, but they are still going to get the variable field 
names wrong, and I do not want that.

Another option would be for me to write an editor for them 
specially for this purpose. The editor would not have to be 
embeddable into a browser, so I could write it in D. But it'd 
have to use a GUI, which would likely take a relatively long time 
to develop, and thus costly for my employer.

Does anybody know a program/file format that could enable editing 
the fields while guarding against formatting/field naming errors? 
Even if it isn't CSV, it is going to be easier for me to write a 
translator than a GUI editor.
Oct 24 2019
next sibling parent Dukc <ajieskola gmail.com> writes:
On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote:
 Even if it isn't CSV, it is going to be easier for me to write 
 a translator than a GUI editor.
Assuming the file format is simple, of course
Oct 24 2019
prev sibling next sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote:
 [snip]
If they are only opening it in Excel, then you can lock cells. You should be able to do that with VBA.
Oct 24 2019
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Thursday, 24 October 2019 at 16:20:20 UTC, jmh530 wrote:
 On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote:
 [snip]
If they are only opening it in Excel, then you can lock cells. You should be able to do that with VBA.
At least I know it works with xlsx files. Not sure on csv now that I think on it.
Oct 24 2019
parent reply Dukc <ajieskola gmail.com> writes:
On Thursday, 24 October 2019 at 16:20:50 UTC, jmh530 wrote:
 If they are only opening it in Excel, then you can lock cells. 
 You should be able to do that with VBA.
At least I know it works with xlsx files. Not sure on csv now that I think on it.
Hmm, I need to check whether I can do that on LibreOffice Calc. I do not to rely on Ms Excel -in part because I don't have one myself! But if the answer is positive, it might be worth considering. I should be able to make an easy-to-use excel-to-csv translator using Atilas Excel utilites without too much effort.
Oct 24 2019
parent reply Dukc <ajieskola gmail.com> writes:
On Thursday, 24 October 2019 at 16:50:17 UTC, Dukc wrote:
 Hmm, I need to check whether I can do that on LibreOffice Calc.
Unfortunately, no. If there's a way to do that, it's not obvious.
 I should be able to make an easy-to-use excel-to-csv translator 
 using Atilas Excel utilites without too much effort.
This was wrong: Atila's Excel-d enables writing plugin functions, but not reading the spreadsheets. There are other DUB utilities for that, though. I quess I will give my employer two options: Either the price variables are in an one-column CSV and I distribute the key column separately so they don't mess it up, or I take my time to do a GUI solution. Unless somebody has better ideas?
Oct 24 2019
next sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Thursday, 24 October 2019 at 17:41:21 UTC, Dukc wrote:
 

 This was wrong: Atila's Excel-d enables writing plugin 
 functions, but not reading the spreadsheets. There are other 
 DUB utilities for that, though.

 I quess I will give my employer two options: Either the price 
 variables are in an one-column CSV and I distribute the key 
 column separately so they don't mess it up, or I take my time 
 to do a GUI solution.

 Unless somebody has better ideas?
It seems to me that Excel forgets these settings for csv files. I tried locking/protecting some rows and it works fine when it is open, but then Excel forgets it when you save/close/reopen, which makes some sense when you think about it. So you'd have to give up the csv and use xlsx if your users were doing it with Excel. Another solution might be to create another file type that like a csv+. However, you'd have to then have a way to open said csv+, which brings you back to the GUI situation.
Oct 24 2019
prev sibling parent reply Laeeth Isharc <laeeth laeeth.com> writes:
On Thursday, 24 October 2019 at 17:41:21 UTC, Dukc wrote:
 On Thursday, 24 October 2019 at 16:50:17 UTC, Dukc wrote:
 Hmm, I need to check whether I can do that on LibreOffice Calc.
Unfortunately, no. If there's a way to do that, it's not obvious.
 I should be able to make an easy-to-use excel-to-csv 
 translator using Atilas Excel utilites without too much effort.
This was wrong: Atila's Excel-d enables writing plugin functions, but not reading the spreadsheets. There are other DUB utilities for that, though. I quess I will give my employer two options: Either the price variables are in an one-column CSV and I distribute the key column separately so they don't mess it up, or I take my time to do a GUI solution. Unless somebody has better ideas?
Another Symmetry project allows reading Excel files and a third is wrapper and bindings around a C library to write Excel files. We use them in production daily though there may be rough edges for features we don't use. I should think you can use a Javascript library and call it from D. See trading views repo by Sebastian Koppe for an example of this. Bindings are manual currently but he will work on generating them from the Typescript bindings in time.
Oct 25 2019
parent Dukc <ajieskola gmail.com> writes:
On Friday, 25 October 2019 at 21:58:27 UTC, Laeeth Isharc wrote:
 Another Symmetry project allows reading Excel files and a third 
 is wrapper and bindings around a C library to write Excel 
 files.  We use them in production daily though there may be 
 rough edges for features we don't use.

 I should think you can use a Javascript library and call it 
 from D.  See trading views repo by Sebastian Koppe for an 
 example of this.  Bindings are manual currently but he will 
 work on generating them from the Typescript bindings in time.
Sorry for late reply. I was told that I can do this by writing the key field only as a comment (so changing it will do no harm - the real key would be dictated either by an ID number or simply row index). In the case they want me to do it without writing my own GUI, I'm going to consider the DUB solutions first but look at what you said if I still miss something. Thank you.
Oct 30 2019
prev sibling parent reply =?iso-8859-1?Q?Robert_M._M=FCnch?= <robert.muench saphirion.com> writes:
On 2019-10-24 16:03:26 +0000, Dukc said:

 We're planning to have our product preview program to calculate and 
 suggest a price for the product displayed. There are a lot of variables 
 to take into account, so it's essential the users can edit the price 
 variables themselves.
Hi, maybe you want to take a look what we do. We are creating price-predicting formulas for all kind of products. Our solution is used in B2B by sales, engineering and purchasing departments to predict prices for very complex parts and products mostly using 3 to 10 performance drivers. So, it's very easy (and fast) for users to get a good idea about the target-price of a product. Our predictions have a very high precision. Let me know if you want to get some more background information. -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Oct 26 2019
parent Dukc <ajieskola gmail.com> writes:
On Saturday, 26 October 2019 at 10:09:54 UTC, Robert M. Münch 
wrote:
 Hi, maybe you want to take a look what we do.

 We are creating price-predicting formulas for all kind of 
 products. Our solution is used in B2B by sales, engineering and 
 purchasing departments to predict prices for very complex parts 
 and products mostly using 3 to 10 performance drivers.

 So, it's very easy (and fast) for users to get a good idea 
 about the target-price of a product. Our predictions have a 
 very high precision.

 Let me know if you want to get some more background information.
Is there any public overview of that method by any change?
Oct 30 2019