Read a text file as an array

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Read a text file as an array

Post by htuser »

Dear all,
I'm facing to an issue that hashmap could solve easily if it offered the possibility to be saved such as saved array or saved hasmap.
What's the problem?
It's concerning agricultural parcels. Each parcel may have several crop and trees, so the basic information gathering require checkbox to enter theses data.
But, after, we must collect detailed information for each tree and crop on each parcel, this in several rosters (expenses for production, harvesting and marketing regarding to each, on each parcel) . So, for each parcel i must parse checkbox response for each crop, trees and also add a unique code to each.

For example, if for the first parcel i have crops and trees such as:
For ID Items 310
No Parcel Localisation Cultures Arbres fruitiers Arbre Forestiers
1 Nantes Mais, Haricot, Carotte, Tomates Manguier, Avocatier, Agrumes Chene, Acajou, Cedre

CodeParcelle
310_1


I must, for this first parcel have an array with:

CodeCulture Code_Parcelle Culture
1_Mais_Nantes 310_1 Mais
1_Haricot_Nantes 310_1 Haricot
1_Carotte_Nantes 310_1 Carotte
1_Tomates_Nantes 310_1 Tomates
1_Manguier_Nantes 310_1 Manguier
1_Avocatier_Nantes 310_1 Avocatier
1_Agrumes_Nantes 310_1 Agrumes
1_Chene_Nantes 310_1 Chene
1_Acajou_Nantes 310_1 Acajou
1_Cedre_Nantes 310_1 Cedre

Since we have several parcels, so for each farmers, we'll have an array with several lines. And this array will be called on each rosters for collecting specific information for each culture.

What's my first ideas for solving it?
I read somewhere that, it will be possible to use saved array in entry application for the next cut. But, i don't see any documentation to, how to launch a saved arrray in an entry application.
However, i would like to have a solution urgently with existing cspro logic features. So, i'm thinking about save an array as a text file and after, read this file as an array, a list or a hashmap every time i need it. Please does it's possible with actual CSPro logic ?

I'm also thinking about insert them in a external csdb file and query them with sqlquery, but, save to a txt file and read it as an array or list or hashmap seem more correct.
Please any help!
Thanks in advance,
G.VOLNY, a CSProuser from Haiti, since 2004
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Read a text file as an array

Post by josh »

Why not just store the data in an external data file and use writecase/loadcase?
Post Reply