RE: How to query ds for string length
As i further investigated both queries were wrong. As you said my query looked just for first character. The length query also passed string that had more than 10 characters.
So I wanted to try to create a view with a computed field but I did fail again... My code below is always on true I did hope I could use regex here the way I did.
The view is created like this:
SELECT VATNUM, DATAAREAID, PARTITION, RECID, CAST(N'' AS NVARCHAR(20)) AS MYVAT
FROM dbo.CUSTINVOICEJOUR AS T1
public class My_CustInvoiceJour extends common
{
public static server str queryVATNum()
{
#define.CompView(My_CustInvoiceJour)
#define.CompDS('CustinvoiceJour')
#define.VATNum('VATNum')
DictView dictView;
boolean matched;
str ret;
dictView = new DictView(tableNum(#CompView));
var VATValue = dictView.computedColumnString(#CompDS, #VATNum, FieldNameGenerationMode::FieldList, true);
//SysComputedColumn::returnField(tableStr(#CompView), identifierStr(#CompDS), fieldStr(#CompDS, #VATNum));
str VATNumPattern = @"\d\d\d\d\d\d\d\d\d\d";
System.Text.RegularExpressions.Match myMatch;
myMatch = System.Text.RegularExpressions.Regex::Match(VATValue, VATNumPattern);
matched = myMatch.get_Success();
if(matched == true)
{
ret = vatvalue;
}
else
{
ret = "";
}
return ret;
}
}