Jump to content


Photo
- - - - -

creating dynamic file .


7 replies to this topic

#1 Balaram

Balaram

    Member

  • Members
  • PipPip
  • 20 posts
  • Gender:Male
  • Location:INDIA

Posted 28 December 2006 - 06:59 PM

Hello Everybody ,
i have a problem .

i want to create a generic screen wherein i enter a file name and then when i click the OK button , it should give me a CSV file . Now it is not just for 1 file (if there were to be just 1 file , it is very easy sadly it is not <_< )
say i have 10 files ,and i want to have a CSV for all of them , by everytime putting in a different filename.

I have thought of a solution as well .. :eek:

If i could create a temporary dynamic file where i could have all the fields and data of the entered file every time i enter a filename(in other words if i could duplicate the
entered table with the temporary one ) , my problem would be resolved , but then i don't find a way to create a temporary but dynamic file .

Will my solution work ,if it does then how ?

Please suggest if you have any other solution ..

Thanks a lot in advance ..

People a VERY HAPPY NEW YEAR TO ALL OF YOU :rolleyes:

#2 Balaram

Balaram

    Member

  • Members
  • PipPip
  • 20 posts
  • Gender:Male
  • Location:INDIA

Posted 28 December 2006 - 07:02 PM

forgot to add.. i develop in superlayer ..

#3 Tyleulen

Tyleulen

    Advanced

  • Members
  • PipPipPip
  • 59 posts
  • Gender:Male

Posted 28 December 2006 - 07:42 PM

It sounds like you want to use a memory file, but never having used SL I don't know how to do that there.

#4 Vol Yip

Vol Yip

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 393 posts
  • Gender:Male
  • Location:Hong Kong

Posted 29 December 2006 - 02:56 AM

I would suggest you first of all make a LSCALL to list all the filenames (from the folder you save all the files) and save them into a temp file (by dir or ls depends on your O/S), you may also want to delete or move all the files after processing them.

Then you loop the temp file to read all the files from the folder and then proceed them one by one to generate the CSV file.

Does this make sense to you?

#5 Balaram

Balaram

    Member

  • Members
  • PipPip
  • 20 posts
  • Gender:Male
  • Location:INDIA

Posted 29 December 2006 - 06:19 AM

I would suggest you first of all make a LSCALL to list all the filenames (from the folder you save all the files) and save them into a temp file (by dir or ls depends on your O/S), you may also want to delete or move all the files after processing them.

Then you loop the temp file to read all the files from the folder and then proceed them one by one to generate the CSV file.

Does this make sense to you?


Could you please elaborate some more on this ,Could you go a bit deeper . Guess you are making sense but then i have no idea as to how should i proceed.

After i save filenames in a file , How do i loop the temp file to generate the CSV file , please suggest me in superlayer or Native PRO IV term.

Thanks a lot Vol Yip.
I really appreciate your suggestions.

#6 Barry Glass

Barry Glass

    Newbie

  • Members
  • Pip
  • 6 posts
  • Gender:Male

Posted 29 December 2006 - 06:51 AM

I would suggest you first of all make a LSCALL to list all the filenames (from the folder you save all the files) and save them into a temp file (by dir or ls depends on your O/S), you may also want to delete or move all the files after processing them.

Then you loop the temp file to read all the files from the folder and then proceed them one by one to generate the CSV file.

Does this make sense to you?


Could you please elaborate some more on this ,Could you go a bit deeper . Guess you are making sense but then i have no idea as to how should i proceed.

After i save filenames in a file , How do i loop the temp file to generate the CSV file , please suggest me in superlayer or Native PRO IV term.

Thanks a lot Vol Yip.
I really appreciate your suggestions.



Hi Vol,

I think what you are trying to do is to enter the name of a PRO-ISAM file into your screen and have the contents of that file output into a CSV file. If that is your problem, I'm afraid there is no easy way in SuperLayer or Native to do that. One way would be to create a function with an LU for each file that could need to be processed. The reason is that the kernel uses the file definition to get the data types of the fields and unpack the data so a separate LU for each file would be needed.

The only other possibility would be very complicated. You would need to dynamically create a function that uses the file definition for the name entered and also create and add a file definition for the sequential CSV file. You would also need to create logic to add the commas and then automatically gen and run your new function.

#7 Mike Nicholson

Mike Nicholson

    Expert

  • Members
  • PipPipPipPip
  • 196 posts
  • Gender:Male
  • Location:Stockholm, Sweden

Posted 29 December 2006 - 09:44 AM

The only other possibility would be very complicated. You would need to dynamically create a function that uses the file definition for the name entered and also create and add a file definition for the sequential CSV file. You would also need to create logic to add the commas and then automatically gen and run your new function.


Yep, that's about the way to do it ... I've done this before for archiving solutions and it's not particularly difficult but you do need the bootstrap definitions.

I would also say to watch out for "unusual" file definitions, eg. arrays, grouped fields, redefines, alternate keys (if you're on C-isam), that sort of thing. They can catch you out.

Cheers

Mike

#8 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 29 December 2006 - 01:34 PM

Balaram,

If Barry has described your goals, it looks like he and Mike have given you the best answer. I agree with Mike - in that spotaneous function generation is not that hard. However, it does have a very steep learning curve. So, if you've never done it before, it could take you several days to get all of the details ironed out.

One other suggestion:

We have abandoned CSV in favor of Tab delimited.

CSV is a slightly more tedious to read back in (due to the potential for quotes and commas within the data). But, the more significant reason we have found for using Tab over CSV is this.

If you invoke EXCEL CSV-filename, Excel will not automatically parse the file. If you open excel and then open the file within excel, it will bring up the parse.

If, other the other hand, you invoke EXCEL TAB-filename.txt, it automatically parses the file without any prompting.

This may seem like a small difference, but anywhere that we can simplify processes like this for end users, the reduction in support more than justifies our efforts.

hth

Joseph



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users