Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Error: we cannot apply field access to type text.

Hello I got error on this code:

 

 

[DataSource.Kind="Helloworld", Publish="Helloworld.Publish"]
shared Helloworld.Contents = (optional message as text) =>
let  
    endpoint = "https://localhost:44346/WeatherForecast",
    directive= "A",
    cache    = "false",
    keys = endpoint[value],
    command  = Record.FromList({keys}, {"Command"}),
    headers  = Record.FromList({command},{"Headers"}),
    payload  = Json.Document(Web.Contents(endpoint, headers)),
    value = payload[value],
    #"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
   #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table","Column1", headers)
 
in

    #"Expanded Column1";

 

 

the error is: we cannot apply field access to type text.

 

Does anyone know why?

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Why do you use "endpoint[value]" to define "keys"?

 

It is needed to connect to endpoint to get the data firstly.

 

Icey_0-1636091934414.png

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Any updates?

 

 

Best Regards,

Icey

PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

What step causes that error?  It's impossible to test as I don't have access to your endpoint server.

 

You should be getting more than just that error as there are a few problems with the code.  

 

In the first line it looks like you are trying to create a record but you haven't given that record a name e.g. NewRecord = [....]

 

The last line shouldn't end with a semi-colon.

 

The error message we cannot apply field access to type text. is related to records.  I'd say you are trying to do something with a text value but treating it like it's a record.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.