AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.08.2013, 01:16   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Mask characters
Источник: http://blogs.msdn.com/b/axsupport/ar...8/14/mask.aspx
==============

Yesterday, I had a support request where customer wanted to set a fixed length for the main accounts and they did not want to specify a type of characters – they wanted to have a possibility to enter both numeric and alphabetic characters.

In the form Chart of accounts, you can specify your accounts format in the field Main account mask.



There you can use the following mask characters:

& - allow any alphabetic character

# - allows any numeric character

The problem was that there’s no literal mask character that allows alphanumeric or any characters.

For that purpose, we modified the table FinancialTagCategory method doesValueMatchMask adding the new mask character:

? - allow any symbol

Here’re the modifications:

X++:
public static boolean doesValueMatchMask(DimensionValue _value, DimensionValueMask _mask)
{
    #DEFINE.SymbolNumerals('#')
    #DEFINE.SymbolLetters('&')
    #DEFINE.AnySymbol('?')                               
    #DEFINE.FirstNumeral('0')
    #DEFINE.LastNumeral('9')
    #DEFINE.FirstLetter('A')
    #DEFINE.LastLetter('Z')
 
    int strLength;
    int i;
    char maskChar;
    char valueChar;
 
    // No mask allows any value
    if (!_mask)
    {
        return true;
    }
 
    // Value must be same length as the mask
    strLength = strlen(_value);
    if (strLength != strlen(_mask))
    {
        return false;
    }
 
    // Ensure each character matches the literal mask character or is appropriate for the wildcard (number/letter) specified
    for (i = 1; i  #LastNumeral))
                {
                    return false;
                }
                break;
 
            case #SymbolLetters:
                if ((valueChar < #FirstLetter) || (valueChar > #LastLetter))
                {
                    return false;
                }
                break;
 
            case #AnySymbol:                               
                break;                                     
 
            default:
                if (valueChar != maskChar)
                {
                    return false;
                }
                break;
        }
    }
 
    return true;
}
Disclaimer: This programming example is for illustration purposes only. Microsoft disclaims all warranties and conditions with regard to use of the programming example for other purposes. Microsoft shall not, at any time, be liable for any special, direct, indirect or consequential damages, whether in an action of contract, negligence or other action arising out of or in connection with the use or performance of the programming example. Nothing herein should be construed as constituting any kind of warranty.



This allowed us to enter any values and still control the length of the accounts.



I hope it helps some of you and highlights the general literal mask characters that, by the way, used across the product &ndash; for example, in the project module &ndash; the Subproject ID format field.





Have a good day,

Roman





Источник: http://blogs.msdn.com/b/axsupport/ar...8/14/mask.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 15.08.2013, 08:32   #2  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
прикольно.

интересно, почему не воспользовались встроенной функцией match, а занимались разбором строки вручную.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Finding the X++ call stack that caused a crash Blog bot DAX Blogs 2 14.01.2020 13:20
emeadaxsupport: AX 2012 R2 for Retail - Setting up discount coupons with bar codes for scanning into POS Blog bot DAX Blogs 0 26.01.2013 09:12
emeadaxsupport: What to do if you have a crash Blog bot DAX Blogs 0 15.06.2011 18:11
emeadaxsupport: Finding the AX user that caused an AOS crash Blog bot DAX Blogs 0 11.04.2011 00:12
Microsoft Dynamics CRM Team Blog: Data Migration and Import: Using field delimiter characters in the source files Blog bot Dynamics CRM: Blogs 0 12.11.2008 22:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:25.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.