Hi, I need to put a - before the last character. The field will receive 1234567890 and I need to put 123456789-0
How can I do this?
Thank you very much.
Solved! Go to Solution.
On the OnChange of the Text Box
UpdateContext(
{
varDash:
With(
{wChar: Self.Text},
Left(
wChar,
Len(wChar) - 2
) & "-" &
Right(
wChar,
1
)
)
}
);
Reset(Self)
On the Default of the Text Box
If(
!IsBlank(varDash),
varDash,
Parent.Default
)
On the OnVisible of the screen and at with any Save code (if you do not leave the screen)
UpdateContext({varDash:false})
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @elaaadani ,
Try this
With(
{wChar:YourTextControlName.Text},
Left(
wChar,
Len(wChar)-2
) & "-" &
Right(wChar,1)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
It does not work. It says it has a number of invalid arguments. Besides an unexpected character in this line
{wChar:YourTextControlName.Text},
I put this
With(
{wChar:RutOnombre.Text},
Left(
wChar,
Len(wChar)-2
) & "-" &
Right(wChar,1)
)
Hi @elaaadani ,
It does work as below using a text box named exactly as your example
What are you doing different?
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Are you trying to do it to the same text box as the input? That is a bit more complex. Please confirm That code was designed to write to the source and then display it.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
On the OnChange of the Text Box
UpdateContext(
{
varDash:
With(
{wChar: Self.Text},
Left(
wChar,
Len(wChar) - 2
) & "-" &
Right(
wChar,
1
)
)
}
);
Reset(Self)
On the Default of the Text Box
If(
!IsBlank(varDash),
varDash,
Parent.Default
)
On the OnVisible of the screen and at with any Save code (if you do not leave the screen)
UpdateContext({varDash:false})
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @WarrenBelz
It doesn't work for me. I always get this same error !
Number of invalid arguments. 1 was received, but 2 were expected
Here is the exact code I used and it worked exactly as expected in testing
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
187 | |
70 | |
49 | |
36 | |
25 |
User | Count |
---|---|
239 | |
111 | |
89 | |
88 | |
66 |