cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Collection Invalid use of '.'

Issue:  Recieving "Invalid use of '.' " Collect button.Onselect

 

When I set my formula for the Collect button using OnSelect = Collect(Destinations, txt_CompanyName!Text) PowerApps reverts the " ! " back to Collect(Destinations, txt_CompanyName.Text) and I get error message (see Issue section).

 

Any help is greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Collection Error.png

 

Input Controls:

  1. Contact Name = txt_ContactName
  2. Company Name = txt_CompanyName
  3. Title = txt_Title
  4. Contact # = txt_ContactNumber
  5. Email = txt_Email

 

Steps

  1. Select the Collect button
  2. In Formula at top, Enter Collect(LeadDetails,{CompanyName:[@txt_CompanyName].Text,ContactName:[@txt_ContactName].Text,Title:[@txt_Title].Text,ContactNumber:[@txt_ContactNumber].Text,Email:[@txt_Email].Text})
  3. Save
  4. Run Test
  5. End

 

Resolved

1. Input controls required the ' [ ] ' (i.e. [@txt_CompanyName].

View solution in original post

7 REPLIES 7
Drrickryp
Super User II
Super User II

Hi @Anonymous,

I believe you have a syntax problem with the collect function. The syntax is Collect( DataSource, Item, ... ).  The items are enclosed in curly braces and are in the syntax- ColumnName:ControlName.Text), so if the columns in your data source are companyname, contactname, title, contactnumber, emailaddress and the names of your TextInput controls are txt_CompanyName, txt_ContactName, txt_Title, txt_ContactNumber, and txt_Email, the button should be Collect(destinations,{companyname: txt_CompanyName.Text,Title: txt_Title.Text, contactnumber: txt_ContactNumber.Text,emailaddress: txt_Email.Text}).  I Hope that helps.

Anonymous
Not applicable

@Drrickryp Many kudos for being so prompt to help a fellow community member, thanks so much! 

Always a pleasure.  It's becoming a hobby!

Anonymous
Not applicable

@Drrickryp  - Thanks for your help here.  I tried your recommendation as well, but I was still prompted with Errors = "Invalid use of '.' btn_Collect (Collect button).  Initally from research I've done.  I was referred to use " ! " after inputs (i.e. Collect(Destination, {CompanyName: txt_CompanyName!Text, ContactName: txt_ContactName!Text}) and that worked, but when I tried to add to the formula that's when the " ! " turned to " . " and I started getting those error messages. 

 

This is a Offline Form BTW.


Hi @Anonymous,

 

Are txt_CompanyName and txt_ContactName text control? If so, the formula should use "." not "!".

 

See in Operators reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators

 

"!" is equivalent to the Not function.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-monli-msft  As I mentioned earlier, when I used " . " I still recieved errors (See formula in earlier thread).  " ! " can be used as backwards compatiability as refered to the document you referenced and in another example that I found online.  When I used the " ! " it worked, but as I continued to build the formula for the button, something changed.

Anonymous
Not applicable

Collection Error.png

 

Input Controls:

  1. Contact Name = txt_ContactName
  2. Company Name = txt_CompanyName
  3. Title = txt_Title
  4. Contact # = txt_ContactNumber
  5. Email = txt_Email

 

Steps

  1. Select the Collect button
  2. In Formula at top, Enter Collect(LeadDetails,{CompanyName:[@txt_CompanyName].Text,ContactName:[@txt_ContactName].Text,Title:[@txt_Title].Text,ContactNumber:[@txt_ContactNumber].Text,Email:[@txt_Email].Text})
  3. Save
  4. Run Test
  5. End

 

Resolved

1. Input controls required the ' [ ] ' (i.e. [@txt_CompanyName].

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (11,868)