# Apply the character-counter formulas

Select the named control and property in Power Apps Studio, then paste only that property's expression from `character-counter.fx`. The file is a property reference, not an executable script or app import. There are no external library dependencies.

- The example input is `DataCardValue30`. Find your actual input in Tree view and replace its name in every applicable expression.
- Add a modern Text control inside the field's data card and name it `CharacterCountRecommendation`, or adapt that name too.
- Set MaxLength to the chosen positive input limit. Use either the fixed-limit counter or the MaxLength-reference variant, not both.
- Current modern Text Input output is Text. The Value formula is only for older controls whose property list still exposes Value. Do not apply this change globally to other control types.
- TriggerOutput belongs to the input. Set it to `TriggerOutput.Keypress` for immediate dependent-label updates. OnChange is a separate event.
- 32 and Align.Right reproduce example styling; adjust dimensions and alignment to the app. Allow enough width and height for the counter and existing validation error.
- Preserve the card's data bindings and validation. If a control update makes a previous `.Value` reference invalid, repair that input's card Update formula to the actual current output and check all affected references.
- Keep MaxLength consistent with data-source limits. This label neither saves data nor adds a server-side rule.

Before publishing, test empty input, typing/deletion, paste, a value exactly at the limit, existing values longer than the limit, normal validation errors, narrow layouts, and the form's save/cancel actions. For the 400 example, 49, 57, 58 and 400 characters produce 351, 343, 342 and 0 remaining. A negative result reveals a length/limit mismatch and is not silently clamped.
