Wednesday, July 28, 2010

CONTROL NUMBERS

Previous post

http://altovamapforceedi.blogspot.com/2010/07/interchange-ids-one-of-first-things.html


Go ahead and continue using your project from above and we will just add control numbers to it. Let’s start off with giving a name to a fictitious company. Let’s name it GORDO. Ok, now that that is out of the way next let’s create a database for storing the control numbers. I named my database EDI, and I created a table that I called Counter. Create the table with this structure, CounterType (varchar 30) and CounterValue (int 4)


(This is of course is just one simple example and can be tailored to your needs)

So open the table in edit mode and then type in GORDO for the CounterType and 0 for the CounterValue. This will be the starting point of our control number.

Ok, now that we have our tiny database and table we need to bring it into Mapforce.

 Click on the insert database button.  
 

Use the connection wizard to select your EDI database and Counter table. Choose your settings based on your particular database setup.

Your database will look something like this.

The next component we will need is the select statement. So click the SQL-WHERE button


 Connect the CounterValue output to the table input of the SQL-WHERE component.

This will open up a window for you to type in your select statement.


The syntax of this box takes a little getting used to. You are typing in the where clause. To create a variable (parameter which shows up as an input box) you put a colon in front of your text. Since we wish to select the CounterValue based off of the CounterType, we will create a variable and assign it to equal the CounterType.

I named my variable the same as the column so the syntax looks like

CounterType =:CounterType

You can leave it as auto-detect by database or explicitly set it to a string.

Next we create a string constant of GORDO and connect it to the CounterType variable input box that we just created on the SQL-WHERE component. (To create a string constant just right click anywhere that is blank on your project and choose Insert Constant)

The connections will look like this.



Stay tuned for next time.... on simple debugging.


No comments:

Post a Comment