Jump to content
Macro Express Forums

Comparing a variable


eddoria
 Share

Recommended Posts

Hi there, first time poster in this forum.

 

I have written a macro to allow uploading from a csv file which is working fine. However there are instances where we have the same order numbers so I want a different set of instructions to run.

 

What I need to happen is:

 

Compare order number for each line to be uploaded. If the next instance is the same as the one before, then do some instructions if it is not the same do another set.

 

How is this possible?

 

Any help would be greatly appreciated.

 

Edd

Link to comment
Share on other sites

Something like this might get you started.

ASCII File Begin Process: "test.csv" (Comma Delimited Text )
 If Variable %T54% = "%T4%"
// Order number matches previous
 Else
// Order number is unique
 End If
 Variable Modify String: Copy %T4% to %T54%  // copy order number to T54
ASCII File End Process

Link to comment
Share on other sites

Thanks very much for the response. I am not sure how to use your code though. Sorry but very new to this.

 

My code is to process the csv with the following steps (but not all would take too long):

 

1) Tab to the Customer No T1

2) Tab to the rest of the fields to be filled out T2-T3

3) Open up the new screen

4) Enter in the order number T4

5) Tab to the Item T5

6) Tab to the Quantity T6

7) Down Arrow one row

8) Hit OK twice

9) Place Order

10) Add another order

 

At this point I need to see if the order number placed in T4 is the same in the next line which will be processed after step 10.

 

If it is the same I need to only do steps 5-7 for each new item on the same order.

 

Once the order number is different then continue on with step 8 to 10 and start all over again.

 

I am not sure about how to use your code (sorry again). Will not it always be T4 no matter what line it is? They do not increment in each line?

 

Regards

 

Vera Hawkins

Link to comment
Share on other sites

From your decscription it sounds like you are processing through using Excel or some other program. You may find it easier and more reliable to process the csv file within Macro Express itself. The ASCII Text Begin Process command repeats all the steps between the Begin and End commands for each line in your csv file. Each time it repeats it will put the order number in T4 from the new line in the .csv file. To compare with the previous order number you need to save the current order number into a variable that will not change. If your loop is using T1 through T6 then you could save the previous order number in T10 through T99.

 

There is a description in the help that describes the ASCII Text Begin/End Process commands. Open help, click the Search tab, type ASCII Text File and click the List Topics button.

Link to comment
Share on other sites

Thanks heaps for the response. We are processing a csv file. I will give it a go. My concern is that I need to compare the order number half way through the loop. I dont want to go back to the very beginning. It is when I get to variable T4 that I need to compare T3 with the new line before it is processed.

 

My situation is that I am loading up information against an order number. This can have a few items in it. So currently I am doing a record for each order number and each item. So that for a customer we could have 7 individual printouts where I would like to have only 1.

 

So to enable me to do this, I need to set if the next line in the csv file is the same order number as the one I am currently processing. If it is then I need to add another item. If it is not, then continue and create a new record.

 

Hope this makes sense. Will your suggestion cater for that?

 

Regards

 

Vera

Link to comment
Share on other sites

I need to set if the next line in the csv file is the same order number as the one I am currently processing. If it is then I need to add another item. If it is not, then continue and create a new record.

The sample provided above does that. Look at the comments "// Order number matches previous" and "// Order number is unique".

I suggest you start with something and see how it works and then adjust it.

Link to comment
Share on other sites

That is a sample to try to give you some ideas. T54 is supposed to hold a copy of the last order number. Upon reexamination of the same I see the confusion, this:

Variable Modify String: Copy %T54% to %T4%

should be this:

Variable Modify String: Copy %T4% to %T54%

I did not try to run this sample. it was provided to get you started.

 

I edited the example above to fix the incorrect line.

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