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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF Lookup record Ques...
Power Apps
Answered

PCF Lookup record Question

(0) ShareShare
ReportReport
Posted on by 32

I have a question from pcf.
I want to get other records from dataset except for the name of the table associated with the lookup record. What should I do?

 

 

I can get only name from record

const subLookup = <ComponentFramework.LookupValue>(record.getValue(this._subLookUpStr));
I have the same question (0)
  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @nanenchanga , 

    Let me check if I understood the question.
    You have a dataset, and want to get the table name for a lookup?
    Using the getValue() on a lookup you get the etn, id and the name

    DianaBirkelbach_0-1681468021463.png

    Maybe you want to get also more columns from the table pointed out by the lookup.
    In that case you can use the dataset "linking": https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/linking?WT.mc_id=BA-MVP-5004107

    For the linked tables, you can add columns using "addColumn": https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/dataset/addcolumn?WT.mc_id=BA-MVP-5004107

     

    I've wrote a blog about all kind of linking with dataset here. Maybe it helps you further: https://dianabirkelbach.wordpress.com/2022/06/12/pcf-dataset-relationships-linking-in-model-driven-apps/

     

  • nanenchanga Profile Picture
    32 on at

    Thank you for your help.
    I wanted to get the values of the linked table as you thought.
    I will make it referring to your blog and let you know if I have any questions.

  • nanenchanga Profile Picture
    32 on at

    Hello.
    I tried to connect to Dataset using your example source code, but it didn't work properly.
    Please check which property should be put in.

    brasov2de/DatasetExample at 2_simpledataset-extended-relationship (github.com)

     

    The following table views exist and you want to get a specific value for the associated table in 'SubLookUp'.

    nanenchanga_1-1681715317241.png

     

     

    The following table exists and the name is 'cr072_onlynamable'

    I want to extract 'cr072_subname' from here.
    image.png

    And I set the PCF's Properties as follows.

    nanenchanga_0-1681715002109.png

    But I can't any data in view

    What is the wrong setting?

    ----------------------------------------------------------------------

    And it's a problem with modifying my code, not an example.

    And in my source code, I added the following code within the init method

    I don't know how to extract the desired value afterwards.

    image.png

     

     

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

    Hi @nanenchanga 

     

    Just in case it applies to your use case: if you don't need a generic PCF, there is another solution: you just extend the view where the PCF is called. Because in the views you can add columns from a linked table, as long it's a many-to-one relationship.

    Now back to the programmatic approach:
    You could try first with hardcoded names. Just to get an understanding,

    From the screenshots above, I didn't git the name of your main table (the one you apply the PCF on). So from I've got there would be

    //<NAME> would be the name of yozr main tabbe
    context.parameters.dataset.linking.addLinkedEntity({
     name: "<NAME>",
     from "<NAME>id",
     to: "cr072_sublookup",
     linking: "innner",
     alias: "ParentRelation"
    });

     This one adds only the relationship. Then you need to add the column (also in init)

    (dataset as any).addColumn("cr072_subname", "ParentRelationship");

    So when you get the data, you can access the column

    dataset.records[...].getValue("ParentRelationship.cr072_subname")

     I have a section about addColumn also in my blog (https://dianabirkelbach.wordpress.com/2022/06/12/pcf-dataset-relationships-linking-in-model-driven-apps/)

     

    Hope it helps!

  • nanenchanga Profile Picture
    32 on at

    Thank you so much for your help.

    I solved it using the other method you suggested, 'Multiple-Datasets with Link'.

    However, I still don't understand how to use linking.
    It doesn't seem to work well even if you add a value with hard coding.

    Can I try a few more days and ask you again if it doesn't work?

    And I think your blog will help me a lot. Can I translate the contents of blogs and git hubs into Korean and share them on my blog or something?

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

    Sure, @nanenchanga  🙂 Take your time and try things out.

    You can have a look to the Network Protocol in the Browser devtools, while the PCF is running. There you'll see the request which get generated, and you'll easily figure out what you need to change in dataset linking, to make it work.

    Love Korean 😊
    Sure, fell free to translate. Just please don't forget to mention the source. 

    Hope this helps! 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 380 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 340

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard