I am trying to build datatable to show Account details. Below are my components

public class getAccountsController {
public static List<Account> getAccounts(Decimal latitude, Decimal longitude)
    List<Account> accounts = [ SELECT
                              id, name,geoAddress__c,DISTANCE( geoAddress__c, GEOLOCATION( :latitude, :longitude ), 'mi' ) dist
                              ORDER BY
                              DISTANCE( geoAddress__c, GEOLOCATION( :latitude, :longitude ), 'mi' ) asc
                              LIMIT 5];
    return accounts;


    <lightning-datatable data={accList} columns={columns} key-field="Id">


import { LightningElement,track,api, wire } from 'lwc';
import getAccountList from '@salesforce/apex/getAccountsController.getAccounts';
export default class Geo extends LightningElement {
    @track accList;
    lat = 80.0;
    long = 100.0;
    @track columns = [{
        label: 'Account name',
        fieldName: 'Name',
        type: 'text',
        sortable: true
        label: 'Distance',
        fieldName: 'dist',
        type: 'Decimal',
        sortable: true


    this.accList = data;
else if (error) {


when i try to deploy the lwc from vscode to org i get error : TypeError: LWC1007: /home/sfdc/tools/lwc/1.17.9-232.0/geo.js: Property property of MemberExpression expected node to be of a type ["Identifier","PrivateName"] but instead got "StringLiteral"

Also when i remove wire method , the component deploys successfully.


This seems to be a problem with property name long, it gives an error when marking that property as a dynamic and reactive with $long.

Cause of error might be because long is a reserved word in JavaScript.

After changing the property name, I am able to deploy:

lat = 80.0;
longitude = 100.0;

@wire(getAccountList, {
    latitude: "$lat",
    longitude: "$longitude"
wireAccounts({ data, error }) {
    if (data) {
        this.accList = data;
    } else if (error) {
        // Note: always handle exception to show user when something went wrong

If you still want to use reserved words, use a JavaScript object and attach them as property, that seems to be allowed:

address = { lat: 80.0, long: 100.0 };

@wire(getAccountList, {
    latitude: "$address.lat",
    longitude: "$address.long"

Not sure how this thing with '$' works but you should solve this using js variables as follows.

    latitude: this.lat,
    longitude: this.long
  • using this.lat and this.long the component gets deployed successfully but on load of component it is giving error as : Error during LWC component connect phase: [Cannot read properties of undefined (reading 'lat')]
    – Return0
    Sep 26 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.