Hi!
I've created a new method in SysQueryRangeUtil class in AX 2009 that should allow to paste a column of data from the clipboard in form of a comma-separated list and use it as a query range.
That means a column of items, like this:
ItemA
ItemB
ItemC
....
should be converted to the following list: ItemA,ItemB,ItemC,... and then used as a range in the query.
Unfortunately, this does not seem to work. This is how the method looks like:
public static str currentSelection(int _pasteFrom = 1, int _pasteTo = 1)
{
str ret;
TextBuffer tb;
container con, subcon;
int i;
;
tb = new TextBuffer();
tb.fromClipboard();
ret = tb.getText();
ret = strreplace(ret, "\n", ",");
con = str2con(ret,",");
if (_pasteFrom <= _pasteTo)
{
for (i = _pasteFrom; i < (_pasteTo > 1 ? _pasteTo : conlen(con)); i++)
{
ret += SysQuery::value(conpeek(con, i)) + ",";
}
}
ret = substr(ret, 1, strlen(ret) - 2);
info(ret);
return ret;
}
The output of the method (when used as a separate job) is correct - it returns a comma-separated list (ItemA,ItemB,ItemC...). For some reason, using this in a query range does not filter the form properly (the form doesn't return any records). I can clearly see that AX recognized the method (entering some other method name returns an error, checking "ret" to some fixed value works properly) but something's wrong...
I would be grateful if You guys could take a look at it and let me know what You think.
Lukasz