Normal Topic [Solved] Array questions (Read 397 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
[Solved] Array questions
Dec 19th, 2007 at 4:58pm
Print Post Print Post  
I want to have a method to check that the items in a shipping box are correct prior to sealing and generating a shipping label. My intent is to shoot a barcode on the picking ticket that will retrieve the order then have a command button that opens a box for the barcode from all the products being shipped to be shot into. The list of shot barcodes will then be compared to the items on the invoice. The results of the comparison will be either displayed on the screen as ok or problem or finish a process of some sort.

My thought process is below. I am weak when it comes to Arrays so help is appreciated. Before I go off down the wrong road does my scenario (sudo code) below hold water? Is there a better way I should look at?

Thanks

Command button opens text box and makes a continue button visible

User Shoots in barcodes from all products in box. (I will need a way to add separator – If needed I can add barcode with separator already included on product)

User Presses the continue button, The application will

Make continue button Not visible

Create a string array from the barcode entries above. This is string array Alpha (do I use @AccessDynamicArray or @createDynamicArray  or actually something for string Array to create this array or is it a string Array already if it is a list with the correct seperator)

Create a  string array  for all the line items in the appropriate quantities that are on  the ivoice. This is string array Bravo (same question as above as to best way to create string array from the line Items. I will need multiple items of  same items in string based on quantity)

//Compare the string arrays and find the difference.

use @differencestringArray (Alpha, Bravo) to see if something is missing from the box

Use @differencestringArray (Bravo, Alpha) to see if anything extra is in the box

Display results
« Last Edit: Dec 20th, 2007 at 12:38pm by Hammer »  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Array questions
Reply #1 - Dec 19th, 2007 at 6:15pm
Print Post Print Post  
BOBSCOTT wrote on Dec 19th, 2007 at 4:58pm:
Create a string array from the barcode entries above. This is string array Alpha (do I use @AccessDynamicArray or @createDynamicArray  or actually something for string Array to create this array or is it a string Array already if it is a list with the correct seperator)


It's a StringArray already as long as each item is seperated by the same delimiter.

Quote:
Create a  string array  for all the line items in the appropriate quantities that are on  the ivoice. This is string array Bravo (same question as above as to best way to create string array from the line Items. I will need multiple items of  same items in string based on quantity)


Something like

Code
Select All
Var vBravo as String
Var vRecLoop as Int
Var vRecCnt as Int
Var vItemLoop as Int
Var vItemCnt as Int
Var vSubName as String
Var vItemName as String

vSubName = "LineItems"
vRecCnt = @FormResultSetTotal(vSubName)
vRecLoop = 1
vBravo = ""

While vRecLoop <= vRecCnt
{
	vItemName = @FormFieldValue(vSubName, "Product", vRecLoop)
	vItemCnt = @FormFieldValue(vSubName, "Qty", vRecLoop)
	vItemLoop = 1

	While vItemLoop <= vItemCnt
	{
		vBravo = @AppendStringArray(vBravo, vItemName)
		vItemLoop = vItemLoop + 1
	}
	vRecLoop = vRecLoop + 1
}
Writeln(vBravo) 



Quote:
//Compare the string arrays and find the difference.

use @differencestringArray (Alpha, Bravo) to see if something is missing from the box

Use @differencestringArray (Bravo, Alpha) to see if anything extra is in the box

Display results


Looks good to me.
-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Array questions
Reply #2 - Dec 19th, 2007 at 11:40pm
Print Post Print Post  
Thanks Ray once again  Smiley

I have it working well. Mark it SOLVED!
Here is the code (below) I will probably turn the missing and the extra elements green using pushattributes when there is no extra or missing.


Var vBravo as String
Var vRecLoop as Int
Var vRecCnt as Int
Var vItemLoop as Int
Var vItemCnt as Int
Var vSubName as String
Var vItemName as String
Var vAlpha as String
Var vmissing as String
Var vextra as String



Valpha = @Replace(pickedItems, @Newline(), ";") //shot barcode Items


vSubName = "LineItems"
vRecCnt = @FormResultSetTotal(vSubName)
vRecLoop = 1
vBravo = ""

While vRecLoop <= vRecCnt
{
     vItemName = @FormFieldValue(vSubName, "Prodid", vRecLoop)
     vItemCnt = @FormFieldValue(vSubName, "Qty", vRecLoop)
     vItemLoop = 1

     While vItemLoop <= vItemCnt
     {
           vBravo = @AppendStringArray(vBravo, vItemName)
           vItemLoop = vItemLoop + 1
     }
     vRecLoop = vRecLoop + 1
}


//Writeln("shot items is " + vAlpha)

//Writeln("All items on order is " + vBravo)

vmissing=@differencestringArray(Vbravo, VAlpha)

//Writeln("missing not on Vbravo " + vmissing)
missing = @Replace(Vmissing, ";" , @Newline())

vextra=@differencestringArray(VAlpha, VBravo)

//Writeln("extra not in valpha "+ vextra)

Extra = @Replace(Vextra, ";" , @Newline())
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged