web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Pass 2 Collections as ...
Power Apps
Unanswered

Pass 2 Collections as an input to Dataset Type PCF

(0) ShareShare
ReportReport
Posted on by 39

Hello All,

I want to give 2 different collections as input to my PCF. So, for that, I have created a Dataset Type PCF Component and copy-pasted the dataset property twice in the ControlManifest.Input.Xml file, as given below:

<data-set name="importCollection1" display-name-key="Import Collection1"></data-set>
<data-set name="importCollection2" display-name-key="Import Collection2"></data-set>

 

After importing this component into CanvasApps, I am able to pass my one collection through the "importCollection1" property, but through the second property, I am NOT able to pass my second collection. It always shows "None" in the second property even if I select any collection from the dropdown.  PFA of the screenshot for the same.

 

Can anyone help me with some solution for this?

 

1-MultipleDataset.PNG
I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hello @optimisticdipak , 

     

    I had a look, and it seems only a display error in the designer.

     

    When you use a table or a view for the second dataset, they are shown (in my case Contacts table):

    DianaBirkelbach_2-1643998332769.png

     

    but when you choose Collections they are not shown on the right side, but the items for the dataset are shown in the formula bar area <the name of the property>_Items

    DianaBirkelbach_0-1643998203994.png

    The collection is shown also when you switch to "Advanced" tab

    DianaBirkelbach_1-1643998290029.png

     

    I had a look also when playing the app: the collection was provided at runtime too.
    So I guess you can ignore the "None" beeing shown there and just go on.

    Hope this helps!

     

  • optimisticdipak Profile Picture
    39 on at

    Hi @DianaBirkelbach,

    Thanks for your response.

    Actually, I want to use my both the collections into the PCF code to execute some operations. So, while executing operation using the collection passed through "importCollection1" property, everything is running fine and we are  not getting any error. But while executing operations using the collection passed through "importCollection2" property, we are getting error saying, 

     

    index.ts:1408 Uncaught TypeError: Cannot read properties of null (reading 'toLowerCase')

     

    I think, the code is getting null value when reading the "importCollection2" property even though I have passed the collection through it in a same way as I have done with the "importCollection1". The property value is showing  "None" as we have seen in your post also, that means the collection is not getting passed through the "importCollection2" property.

     

    Could you/anyone help with some solution on this?

     

    Awaiting your response.

    Thank you.

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @optimisticdipak , 

     

    I suppose the problem is nothe the "None" being shown in the designer. You would need to have a look at line 1408 in your index,ts. 
    I've used the example shown above with 2 datasets and is working fine (also when the seccond dataset is a collection and None is shown in the designer). I suppose you call somewhere "toLowerCase" which happens to be called to a null object. Maybe is something you get from the dataset, but I suppose that the dataset itself is not null.

    Hope this helps!

  • optimisticdipak Profile Picture
    39 on at

    Hi @DianaBirkelbach,

    The problem is due to the same reason I stated in my earlier post: the code is getting null value when reading the "importCollection2" property. It means, I am not able to pass the collection form the "importCollection2" property.

     

    I was applying "toLowerCase"  to the values fetched from this property and since, it is Null, we are getting that Null value issue.

    I have checked the code at line 1408 also. It is commented line in my code. So the issue is not due to that.

     

    Basically, I am trying to iterate over the collection values passed through "importCollection2". I am getting Null values through it. Maybe you can also try iterating over the collection passing through the second Dataset property and let me know whether it works for you or not.

    You can refer my code of iteration,

    var objectSortedRecordIds = this.theContext.parameters.importCollection2.sortedRecordIds;
    
    var objectColumns = this.theContext.parameters.importCollection2.columns;
    for(const n in objectSortedRecordIds){
     let currentRecord = this.theContext.parameters.importCollection2.records[objectSortedRecordIds[n]];
     for(const n in objectColumns){
    	let temp = currentRecord.getFormattedValue(objectColumns[n].name);
    	console.log("Temp Record: ", temp); // Getting Null value here
     }
    }

     

    Eagerly awaiting your response

     

    Thanks.

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard