Skip to main content

Fixed: "The '.' Operator Cannot Be Used on Error Values" in Power Apps

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

The '.' operator cannot be used on Error values means the name on the left of a dot has already failed, so Power Apps can't read a field from it. In my case, a copied control brought along a context variable that only exists on another screen. The fix is on the left of the dot.

What I Was Doing​

I was adding the Review screen to the Career Development Plan app (Part 8). Every screen in the app has the same header: a Back button and a title. To reuse it, I copied the Team Member screen's header, conHeaderTMS, and pasted it onto the new screen (How to Copy and Paste Controls Between Screens).

On the Team Member screen, the title shows the person's name:

lblTitleTMS → Text
locMember.displayName

What I Expected​

A copy of the header on the new screen, with the same title formula, ready for me to change.

What I Got​

The pasted title, lblTitleTMS_1, showed a red ⊗ on the canvas, and the App checker icon got a red dot. In the formula bar, the formula was underlined in red, and pointing at it showed this message:

The formula bar with locMember.displayName underlined in red and a hover box reading The '.' operator cannot be used on Error values., with View Problem and No quick fixes available, and a red error icon on the pasted header's title on the canvas

Error
The '.' operator cannot be used on Error values.
View Problem (⌥F8) No quick fixes available

What I Checked​

The formula has a name, locMember, a dot and a field, displayName. The message is about the dot, so I checked whether the name on its left had a problem of its own.

  1. View Problem said 1 of 2 problems, and the first one was Name isn't valid. 'locMember' isn't recognized.
  2. The App checker's Formulas list showed both errors, on the same property:

The App checker's Formulas pane with Errors (2) under Review Screen (2): Name isn't valid. 'locMember' isn't... and The '.' operator cannot be used on..., both on lblTitleTMS_1 .Text

So the dot error was a consequence. The real problem was that locMember wasn't valid on this screen. On the Team Member screen, the same formula has no errors.

Why It Happens​

locMember is a context variable. The Team Member screen gets it from the Navigate that opens it, Navigate('Team Member Screen', ScreenTransition.None, {locMember: ThisItem}) (How to Go to Another Screen with Navigate).

Microsoft's article on variables gives context variables the scope Screen: you reference them from only one screen (Understand variables in canvas apps). Copying a control copies its formulas, but the variable stays on its own screen. On the new screen, locMember is an error, and .displayName asks for a field of that error.

If a variable doesn't exist anywhere in the app yet, Studio shows only the name error. That's the case in Fixed: "Name Isn't Valid. 'locMember' Isn't Recognized".

The Fix​

Fix the left side of the dot: give the copied control a value that exists on its new screen. The Review screen's title is fixed text, so I set:

lblTitleTMS_1 → Text
"Review response"

If the new screen needs the same value, pass it to that screen with its own Navigate, which creates a context variable there (How to Use Context Variables with UpdateContext).

After the Fix​

The underline and the red ⊗ were gone, and the header showed its new title:

The formula bar with "Review response" and the preview strip "Review response" = Review response, Data type: text, and the pasted header on the canvas showing Back and Review response

The App checker's Formulas list was empty:

The App checker's Formulas pane reading No errors found

Then I renamed the pasted controls for their new screen (How to Rename a Screen or Control).

Common Mistakes​

MistakeWhat happensDo this instead
Fixing the dot, for example by removing .displayNameThe name error staysFix the name on the left
Pasting controls without checking their loc variablesErrors on the new screenChange each formula that uses a variable from the old screen
Switching to a global variable to get around itThe value becomes app-wide, shared by every screenPass the value with Navigate

Troubleshooting​

SymptomLikely causeFix
The error is on a pasted controlIts formula uses a context variable from the old screenGive it a value that exists on this screen
The error is on a control you didn't copyThe variable isn't created anywhere yetFixed: "Name Isn't Valid"

FAQ​

Why did the hover show the dot error and not the name error?​

Pointing at the formula showed the dot error, but the formula had both. View Problem and the App checker list every problem on the property, so check them before fixing the first message you see.

Do I need to fix every control I pasted?​

Only the formulas that use variables or controls from the old screen. Plain values, such as sizes and colors, work anywhere.

Conclusion​

The '.' operator cannot be used on Error values points at the dot, but the cause is the name on its left. After copying controls between screens, a context variable from the old screen is the usual suspect, because context variables only exist on their own screen.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.