cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Anonymous
Not applicable

Re: Collection Invalid use of '.' [SOLVED]

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
Highlighted
Super User
Super User

Re: Collection Invalid use of '.'

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.

Highlighted
Community Champion
Community Champion

Re: Collection Invalid use of '.'

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

Highlighted
Super User
Super User

Re: Collection Invalid use of '.'

Always a pleasure.  It's becoming a hobby!

Highlighted
Anonymous
Not applicable

Re: Collection Invalid use of '.'

@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.


Highlighted
Community Support
Community Support

Re: Collection Invalid use of '.'

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.
Highlighted
Anonymous
Not applicable

Re: Collection Invalid use of '.'

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.

Highlighted
Anonymous
Not applicable

Re: Collection Invalid use of '.' [SOLVED]

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,031)