Jump to content
Macro Express Forums

Nesting Loops of files and Appending records to another file or array


Recommended Posts

Hi all,

 

First of all, I work in QA as a freelancer and I am using MEP to automate some of my test work on web sites. Great tool!

 

Now I'm running into a challenge of which I am not sure how to approach it. Bear with me, I'm still rather new with this tool, so I might be missing the obvious.

 

I cannot give you the exact details of what I am working on due to NDA in my work, but I'll try to give you the outline of what I have to accomplish.

 

My macro has to select values in fields that vary depending upon previously selected values.

 

e.g. At first I have the option to select values A, B and C. Once I select option A and save it, I also get the option to select option D. Then once I save option D, I can also select option E.

So these are my options:

A

B

C

D (if A was saved first)

E (if D was saved first)

 

I have to deal with multiple records at once, based upon dates. When I save, I save all records at the same time. I cannot save one first, then the other, etc.

 

I created an ASCII file with records of information for the dates I have to save. Per save I would be saving the whole set of one particular date.

 

Example:

date_1, A

date_1, B

date_1, E

date_2, D

date_2, A

date_2, C

etc.

 

To achieve the values for date_1 I would first have to save:

A

B

A

Then go back through them and save the last A as D. Then go back again and save the D as an E.

 

Due to the limitations of the ASCII file process loop (which only searches in a sequential manner) I have to either make multiple passes on the same file (tried that already, but takes far too much time to process), or I need to come up with an intelligent way to hold off processing values D and E, until I first finish the whole set of records, and then save them later.

 

My first thought was to copy all values of the record to a temporary array/file when it runs into a D or E value, flag a boolean so that the macro does an extra pass on the saved records once it finishes all of them for the selected date. The other values should be available then, so that should work. However, I am not sure how to accomplish this in an efficient manner.

 

My ideas so far:

1) Create a new file with the records pasted in there and process that file at the end of a date sequence. However, I have not found a way to do that with MEP.

2) Copy records to an array, though I am not sure how to do that. Copy value[1], then value[2] etc. came to mind, but once done, I have not discovered a way to read record by record from an array. There is also no record pointer manipulation option, so I'm not sure how to go about this.

 

The main issue is that I cannot let the ASCII loop finish first. I really have to run an IF statement with a REPEAT that should process all values within the ASCII loop.

 

I hope I am still making sense to the lot of you. :)

 

Basically I need a way to temporarily copy records to a file or an array, so that I can process them later, and repeat that X number of times.

 

Any suggestions are most welcome.

Link to comment
Share on other sites

i've been looking at this and the post labeled Dynamic Array seems to be somewhat related. the last part of your post i don't quite understand... maybe you can post what you have (without giving away what the purpose is) and someone here can help sort it out and clean it up.

 

so you can begin by creating a multiple choice menu A,B,C... and opening up additional options is fairly straightforward and can be accomplished using conditional statements which will open up additional choices D and E if certain previous choices are made and loop for additional entries, saving the data to unique variables over each repetition.

 

the next module is not as clear. i'm not understanding what the file manipulation is to accomplish.

 

lastly, the bit about how to enumerate the array variables can be done with some string manipulation i believe.

 

maybe start with breaking this up into modules... collect data into array; modify data into date sequenced files?; copy data/files into whatever requirements you have.

 

how far did you get with your script thus far?

Link to comment
Share on other sites

Hi duchi,

 

Thanks for your reply, and sorry that I took some time to respond. In the end I did find a solution to my problem.

 

Basically I had an unknown number of dropdown lists, from which I had to select options. Based upon a first selection, other selections became available. Each dropdown has the same options.

 

To be able to select option E, I had to first select A, save, set D, save, and then option E would be available.

 

Since my macro had to switch based upon date, I ended up using this mechanism to make different passes. So in the data file I was using, I just added additional entries, purely to reach the option I needed.

So instead of saying, on date X I need to select option D, I first did a pass where on date X I select option A, then let the macro populate the next day, and after that one, I went back to date X, and selected option D. So instead of breaking my head on the programming of the macro, I let the data file structure do it for me. :)

 

That solves this issue, but raises others. :wacko:

 

I love this macro tool, since it is much better than others, but I often have to deal with highly complicated situations where I in reality need a full blown development language that also allows UI manipulation. They should incorporate PHP in this tool, then it would be perfect! :P Database support is also a must in my mind.... Just simple sequential processing of files is very cumbersome.

Then again, I should not complain, because for its price, this is a pretty awesome tool. ^_^

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...
 Share

×
×
  • Create New...