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

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

TopShelf-MSFT
Level 10

Re: Collection Invalid use of '.'

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

Super User
Super User

Re: Collection Invalid use of '.'

Always a pleasure.  It's becoming a hobby!

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.


Community Support Team
Community Support Team

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

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
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,874)