Jump to content
Macro Express Forums

ASCII file begin


Recommended Posts

Hi I just recently discovered this wonderful program but have hit a major roadblock. I'm trying to fill a form using a CSV so each time it is submitted a new row of info from the csv is entered. I've looked through the video tutorial and the forums but still struggling to define the variables found here. post-4881-128012227364_thumb.jpg

So far I understand each column in a row needs to be given a different name such as T1,T2,T3 and after each loop the data pulled will be from the next row. Any help would be much appreciated or perhaps someone has an example.

Link to comment
Share on other sites

ASCII File Begin Process: "xx" (Comma Delimited Text (.csv))
...
ASCII File End Process

The 3 dots in the above example represent code you write to process the contents of the T variable, i.e. %t[1]% contains the first value of your .csv file, %t[2]% contains the 2nd value, etc. Each time your ... code is executed, MEP moves to the next row in your file. Thus, in your code, you need to display your form each time as if for the 1st time - if you have 10 rows of 5 values in your .csv file, then your form will be displayed 10 times, and you will be using variables %t[1]% through %t[5]%. You will need to insert code to detect when your form is closed each time (use a Repeat command to test when your form window has been closed) so that you can process the edited values (if applicable), and then have MEP display the next row of data.

Link to comment
Share on other sites

Thanks for your reply Paul. That part I understood but the area which I'm having issues with is choosing how the variables are defined (I hope I'm using the right terminology). In other words I have no clue how to fill this section out as seen in the image -->post-4881-128015833522_thumb.jpg

Thus far I've set the following as....

 

Begin processing on record: 1

Variable array to receive results: T1,T2,T3,T4 etc

 

However, what do I set for the properties for the above variables and do I need more variables?

Link to comment
Share on other sites

Create a variable to hold the array. When prompted to create the variable choose the number of elements. You may want to use a variable other than 'T' (T[1] .. T[9]), one that has meaning to you. Perhaps something like InputData.

 

You can create the new variable by typing %InputData% into the 'Variable array to receive result:' field. Then when you click the OK button you will be asked if you want to create it. Click Yes, and then when the Variable Properties dialog comes up, click in the Create as an array and enter the number of Elements.

Link to comment
Share on other sites

Yes, it can be slightly confusing if you've never used this before, or if you were formerly an ME3 user.

 

I would second Kevin's suggestion to avoid using the T variable.

 

So, if you set %InputData% as the "Variable array to receive result", the command will automatically create an array of numbered variables and fill them with each respective line from the file, i.e. Line 1 will go into %InputData[1]%, Line 2 into %InputData[2]%, Line 3 into %InputData[3]%, and so on. You do not have create those numbered variables yourself.

 

However, you do need to define %InputData% as an array. The first time you create a variable you should get a warning prompt saying "Variable currently not defined? Create now?" or similar. Click Yes, and in the variable properties box, make sure the "Create as an array" box is checked. In the Elements box, set a sufficiently large number. This needs to be slightly larger than the number of records you will process.

 

 

-Lemming

 

Thanks for your reply Paul. That part I understood but the area which I'm having issues with is choosing how the variables are defined (I hope I'm using the right terminology). In other words I have no clue how to fill this section out as seen in the image -->post-4881-128015833522_thumb.jpg

Thus far I've set the following as....

 

Begin processing on record: 1

Variable array to receive results: T1,T2,T3,T4 etc

 

However, what do I set for the properties for the above variables and do I need more variables?

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...