How to use CSV Files

Can you please kindly explain how to add CSV file to the MPS and how to get data from it?

For an example, I need to get data from a CSV file and calculate average, max, min and display the results in a form. I already design the form. Problem is how to add CSV file and access data from it

Your support is highly appreciated.

Regards

Pradeep

6 comments

Hi,

A (probably suboptimal) solution is to use TextFile, see j.m.build.startup, it's a plain text file abstraction.

Mar

0

Thank you very much and highly appreciated.

I am new to MPS. Could you please explain hoe to locate/find the

j.m.build.startup 

Is it a sample project?

Regards

Pradeep

0

In one of my behavior model of one of my languages I have a text file, to create it:

  • open the module property (ALT+enter when the language is selected) of your language
  • switch to the dependecies tab
  • add jetbrains.mps.build.startup
  • close the module property
  • select the behavior model
  • ALT+enter again, the model properties will be opened.
  • this time switch to the Used Languages
  • add the jetbrains.mps.build.startup language
  • close the dialog

Now if you right click on the behavior model, into the "New" menu you should be able to select first "j.m.build.startup" then "TextFile".

Hope this will help.

Mar

0

Many thanks Mar,

I will try and if any questions, I will come back to you.

Highly appreciated for your kind help

Kind regards

Pradeep

0

You could have a look at this project: https://github.com/CampagneLaboratory/XChart

We don't expose the data in TSV/CSV, but represent the file and its columns inside MPS, the data stays in the file and can be accessed using regular Java mechanisms (useful when the TSV files are large).

0

Thank you very much Fabien.

I will have a look and let you know.

Highly appreciated.

Kind regards

Pradeep

0

Please sign in to leave a comment.