Jump to content

Recommended Posts

Hello everybody,


I am kind of new to this so I am hoping that you can give me a hand. The task is this:

I have 5 .txt files, each file contains 10 lines of text. I have to randomly select one line from each file and the these generated lines have to be sent through email to two email addresses.

Can you please provide some pointers ?

Thank you!

A better approach which would require more setup work would be to create a table that has an categ/file code to group the 10 lines from each of the 5 files and another "seq" number to identify each line in that categ/file code.

 

Then you simply use the rand function to pick a number from 1 to n for each of your categs and perform a query that selects the categ/seq values that match the random ones selected. Then you do the email.

 

Your current method involves having to open and read each file separately to get your data. Building the db would be much easier to work with and allows for very easy changes to the data to add or remove lines.

 

Just my $.02

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.