So the goal is to size a text input control based on the text entered.
Here is what I have so far which logically makes sense but I obviously have errors cause it doesn't work.
Min(250, Max(60, 40 * RoundUp(CountRows((Len(DataCardValue6.Text)) / DataCardValue6.Width, 0))))
I've also tried this which doesn't work. My thought being that DataCardValue6 may not have an actual value when the expression is processed.
Min(250, Max(60, 40 * RoundUp(CountRows((Len(Parent.Default)) / DataCardValue6.Width, 0))))
That doesn't work the way I wish. I changed the first value in the Min statement to 60 because I want the input box to be small and fit the design. But when I change the 250 to 60 as below, the result is as attached in the image.
Min(60,Max(60,40*Len(Self.Text
It seems that the issue is that 40*Len(Self.Text) produces very large numbers because it represents character count. So for the given content, it's 11280.
This is what works. I didn't need the initial Min statement at all. Just the Max. I may have to modify the multiplier I'm using on the Len calculation for other controls and it may blow up when the form is resized. I'll review responsiveness later. But I'm expecting that the control width is set by the parent(s) so it should still work.
Max(60, 40 * (Len(DataCardValue6.Text))*4.8 / DataCardValue6.Width, 0)
This is the result:
And it works when the form is in Edit mode so the control grows as text is input.
Hi @DCHammer ,
CountRows is used to count items of table. I'm afraid it can't be used as below.
CountRows((Len(DataCardValue6.Text))
Here is a method for your reference.
Width of TextInput.
Min(250,Max(60,40*Len(Self.Text)))
Best regards,
Rimmon
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional