- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 04:34 AM
Here's a thread where we can post our working GRID examples for others to use. I'm often able to get the expression I need to do an edit on scanned data, but I never really seem to know how I did it. I find it much easier to start with a working example so I'd like for the Dev Forum users to contribute as many as we possibly can. I'll start with some of mine in a series of postings.
Please include the tag "GRID" in your postings to make them easy to find.
Thanks!
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 04:39 AM
Here is a GRID that will take a scanned data string and return from it the last two characters.
(.*)(.{2})$=>\2
If you needed the last 3 characters, you'd replace the {2} with {3} and so on. The filter in this expression does not distinguish between numbers or letters. It also doesn't check to see if the scanned data has at least two characters in it.
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 04:45 AM
This has three filters in it which are evaluated in the order they appear. The first one states if a string of characters is >= 28 in length, then pass it as is. The second part states that if the string is from 1 to 26 characters in length, then pass it as is. If neither case 1 or 2 is true, then the string must be 27 characters long, in which case the third filter is applied. It will divide the 27 character string into the first 3 and last 24 characters, and then will return only the last 24.
In simple terms, this GRID strips off the first 3 characters from a 27 character string. If the input string is not 27 characters in length, it returns it as is.
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 05:05 AM
This example shows how to create a filter that applies only to a single barcode symbology. If the scanned data came from an EAN8 barcode, then return only the first five digits. If it came from any other symbology, then pass it as is.
This can be useful in an application where the user is scanning several barcodes, perhaps on a package, each with a different symbology. The GRID picks out one of the barcodes for manipulation but leaves all the others alone.
<SYM:EAN8>([0-9]{5})=>\1;(.*)=>\1;
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 05:09 AM
The attached PDF is a good introduction to GRID strings and contains some more examples.
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
March 26 2010 11:21 AM
Not a GRID example, but something to edit and test RegEx as used by GRID editing easier:
Windows: FreeWare RegEx Coach
Unix: Kodos (Gnome)
-------------==========================--------------
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
code at google com:
http://code.google.com/p/itc-keyboard/
http://code.google.com/p/rdesktop-ce/
http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
February 24 2012 12:52 PM
Hi
attached is another GRID data editing DLL (like the one at this post)
The DLL will add a timestamp and a separation sequence in front of the barcode data and a postamble sequence after the barcode data. Separator and Postamble have to be split by a single '@' char. The separator and postamble show how to use the compile function of a GRID DLL.
You have to define the following GRID in Intermec Settings:
Generic:
<CDEF>pathname|FilterEdit|Compile|parameter_string
Example:
<CDEF>\path\Grid_TimeStamp.dll|TimeStamp|Compile|s
As tested in screenshot below:
<CDEF>\path\Grid_TimeStamp.dll|TimeStamp|Compile|\
The DLL has two exports: "TimeStamp" and "Compile". The parameterstring for Compile will be unescaped, meaning \t, \r and \n will be converted to 0x09, 0x0D and 0x0A. This is usefull to have the following virtual wedge see these control characters and perfom TABs and ENTER.
The attached VS2008 solution (Windows Mobile 5 SDK) has the DLL project and a TestDLL project. The second enables you to test the DLL without a device and using it directly as DataGRID DLL.
And here are some code snippets of the DLL:
#include <windows.h>
#include <string>
#include "ITCCustomFilter.h"
...
ITCFILTER_API Compile( LPCWSTR szInput ){
// The 3rd parameter in the configured filter / edit expression.
TCHAR* szTemp = new TCHAR[64];
memset(szTemp, 0, sizeof(TCHAR)*64);
TCHAR* pszInput = new TCHAR[64];
memset(pszInput, 0, sizeof(TCHAR)*64);
wcsncpy(pszInput, szInput, 63);
memset(s_szPostamble, 0, sizeof(TCHAR)*64);
memset(s_szSeparator, 0, sizeof(TCHAR)*64);
szTemp = stringReplace(L"\\t", L"\t", pszInput);
wcscpy(pszInput, szTemp);
szTemp = stringReplace(L"\\r", L"\r", pszInput);
wcscpy(pszInput, szTemp);
szTemp = stringReplace(L"\\n", L"\n", pszInput);
wcscpy(pszInput, szTemp);
TCHAR* newInput = new TCHAR[64];
wsprintf(newInput, pszInput);
memset(szTemp, 0, 64 * sizeof(TCHAR));
//split string at '@'
TCHAR* wToken = wcstok(newInput, L"@");
if(wToken!=NULL){
wsprintf(s_szSeparator, wToken);
wToken = wcstok(NULL, L"@");
if(wToken!=NULL)
wsprintf(s_szPostamble, wToken);
}
//CleanUp
delete(szTemp);
delete(pszInput);
delete(newInput);
return ITCFILTER_SUCCESS;
}
...
ITCFILTER_API TimeStamp (
LPCWSTR szInput, // [in] input data
DWORD nInputChars, // [in] number of input data characters
LPWSTR szOutputBuffer, // [out] output data
PDWORD pnOutputChars // number of characters in [in] szOutputBuffer, [out] output data
)
{
HRESULT hr = S_OK;
TCHAR* sTimeStamp = new TCHAR[18];
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
//format datetime to 'YYYYMMDD hh:mm:ss'
wsprintf(sTimeStamp, L"%04i%02i%02i %02i:%02i:%02i", sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
DWORD nCharsNeeded = wcslen(sTimeStamp) + wcslen(s_szSeparator) + nInputChars + wcslen(s_szPostamble);
// First check again to make sure we're provided enough space
if( nCharsNeeded > *pnOutputChars )
{
hr = ITCFILTER_TOO_BIG;
}
// Enough space, so do the work
else
{
memset(szOutputBuffer, 0, *pnOutputChars);
wsprintf(szOutputBuffer, L"%s%s%s%s", sTimeStamp, s_szSeparator, szInput, s_szPostamble);
}
*pnOutputChars = nCharsNeeded;
return hr;
}
...
Very easy, or?
-------------==========================--------------
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
code at google com:
http://code.google.com/p/itc-keyboard/
http://code.google.com/p/rdesktop-ce/
http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
February 29 2012 02:56 AM
Hi
I extended Grid_TimeStamp. You now can optionally define a separator to be used between Date and Time. The other change is the usage of the Device's Locale to format Date and Time. Date and Time will be inserted as defined in Locale Settings of device.
code (VS2008, WM5 SDK) is now hosted at code.google.com/p/gridtimestamp
Have fun
Josef
-------------==========================--------------
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
code at google com:
http://code.google.com/p/itc-keyboard/
http://code.google.com/p/rdesktop-ce/
http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
January 28 2013 08:05 AM
Here is another GRID example. This is a three part data editing scenario. This came up recently for a customer. He was scanning three different barcode labels that would contain a four digit number. If that number was found, he wanted the GRID to return only the following six digits, which were always numeric. The four digit key sequences were 3201, 3102 and 3202.
Part one would look like this.
(.*)(3201)([0-9]{6})(.*)=>\3;
Part two would look like this.
(.*)(3102)([0-9]{6})(.*)=>\3;
And, part three like this.
(.*)(3202)([0-9]{6})(.*)=>\3;
So, putting them together, we get this.
(.*)(3201)([0-9]{6})(.*)=>\3;(.*)(3102)([0-9]{6})(
When a barcode was scanned that didn't contain any of these, the customer wanted nothing returned. If, on the other hand, he wanted everything returned instead, one would simply modify the GRID to look like this.
(.*)(3201)([0-9]{6})(.*)=>\3;(.*)(3102)([0-9]{6})(
Re: GRID Examples
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
January 28 2013 08:28 AM
why did you not simply use
(.*)(3[0-2]02)([0-9]{6})(.*)=>\3;
for all three?
-------------==========================--------------
See all my tips and tools at hxxp://www.hjgode.de/dev
and the NEW http://www.hjgode.de/wp
code at google com:
http://code.google.com/p/itc-keyboard/
http://code.google.com/p/rdesktop-ce/
http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk

