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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.07.2018, 23:15   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
powerobjects: Checking for Consecutive Repeating Characters in PowerApps
Источник: https://www.powerobjects.com/2018/07...ers-powerapps/
==============


Today’s blog will walk through how you can check for repeating characters within PowerApps. We at PowerObjects are excited about the functionality of PowerApps and their potential for reducing the time for developing mobile apps. There are many resources to get up and running, including our webinars.

The challenge with checking for repeating characters is that the PowerApps platform does not allow for writing loops within the PowerApps designer. How can you check if char4 = char5 = char6 within a full string? The solution is to leverage regular expressions. JavaScript regular expressions work in PowerApps.

The solution for this use case is to use the IsMatch (Text, Pattern [,Options]) function with the Contains option and combining special characters “.” and “\x” and “{n,m}” to get the desired regular expression pattern: (.)\x{n}

Let’s walk through an example of how to apply these pieces by creating a simple screen.

Steps overview:


  1. Insert a Text Field.
  2. Insert two icons.
  3. Set one icon to display and the other to not display if there are three consecutive repeating characters.
  4. Test it out.
Step 1 – Insert a Text Field



Step 2



Step 3

Set one icon to display and the other to not display if there are three consecutive repeating characters

Input the following expressions in the Visible property of the icons:

Icon 1: If(IsMatch(TextInput1.Text,”(.)\1{2}”,Contains),true,false)

Icon 2: If(IsMatch(TextInput1.Text,”(.)\1{2}”,Contains),false,true)

Let’s break down what each piece means:

IsMatch – checks if the input text matches what you specify in this function

(.) – match any character except a newline character

\1 – remembers 1 preceding character

{2} – matches at least 2 occurrences of the preceding character (exclude the “m” in {n,m} because we are not limiting the number of characters in the string)

Contains – the string specified is within the input text



Step 4 – Test it out

The happy emoji should display only when there are no three consecutive repeating characters, including letters and numbers.





Congratulations! You just executed a workaround for the known limitation that PowerApps do not support programming loops. This is particularly helpful if you need to validate password inputs. You can learn more about the Dynamics 365 Spring 2018 Update for PowerApps in this blog.

Want to learn more about how PowerApps and Microsoft Business Applications can benefit your organization? Join PowerObjects, this year’s Platinum Sponsor, at the Microsoft Business Applications Summit on July 22-24 in Seattle. Register with our code: HCL100dc to receive a $100 discount.

Happy Dynamics 365’ing!



Источник: https://www.powerobjects.com/2018/07...ers-powerapps/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
powerobjects: Want to Learn More About PowerApps? Blog bot Dynamics CRM: Blogs 0 13.06.2018 02:40
powerobjects: Dynamics 365 Spring 2018 Update: What’s New in PowerApps and Flow? Blog bot Dynamics CRM: Blogs 0 31.05.2018 02:17
survivingcrm: Exploring CDS for Apps Platform Licensing (PowerApps) Blog bot Dynamics CRM: Blogs 0 10.05.2018 23:12
powerobjects: 2018 PO TV Academy Awards Blog bot Dynamics CRM: Blogs 0 10.03.2018 00:14
powerobjects: How to Create an Auto Number Without Code! Blog bot Dynamics CRM: Blogs 0 21.12.2017 21:15
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

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