• Irina Khomyakova 38
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I am trying to build SOQL query displaying credit summary for a particular student. We're on EDA so we're trying to use the Course, Course Offering, Course Connection, and Contact objects to generate this. 
Here is query that displays information we need, but only for courses particular student enrolled. We would need to add course information for courses that student is not enrolled.

select (SELECT hed__Course_Offering__r.hed__Course__r.Subject__c,
hed__Course_Offering__r.hed__Course__r.Catalog_Number__c,
hed__Course_Offering__r.hed__Course__r.Name,
hed__Course_Offering__r.hed__Course__r.hed__Credit_Hours__c, hed__Course_Offering__r.hed__Course__r.Course_Name_in_Native_Language__c,
Letter_Grade__c
FROM hed__Student_Course_Enrollments__r where Subject__c ='GDBA' and Catalog_Number__c LIKE '71%')  
from Contact where Id='0031I00001NcWIBQA3'

I also tried this query, but information is not distinct and not properly formatted:

SELECT  hed__Course__r.Subject__c,
hed__Course__r.Catalog_Number__c,hed__Course__r.Name, hed__Course__r.hed__Credit_Hours__c,
hed__Course__r.Course_Name_in_Native_Language__c,
(Select Letter_Grade__c  from hed__Course_Enrollment__r where hed__Contact__c = '0031I00001NcWIBQA3')
FROM hed__Course_Offering__c Where hed__Course__r.Subject__c ='GDBA' and hed__Course__r.Catalog_Number__c LIKE '71%'

I would appreciate any suggestions.
I am trying to create custom Lighting Web Components to display a doughnut chart that process Salesforce data from the server.  I choose LWCC to build my custom chart.  Here is documentation: https://salesforcelabs.github.io/LightningWebChartJS/

When I use static values to build a graph, it works.  But when I try to use SOQL property in js file, I don't seem to grab the data properly.  I could not find any examples of using this property inside Lighting Web component:
Here is my JavaScript file code:

import { LightningElement, track} from 'lwc';
import chartjs from '@salesforce/resourceUrl/ChartJs';
import { loadScript } from 'lightning/platformResourceLoader';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class MyCustomChart extends LightningElement {
    @track isChartJsInitialized;
    chart;
    config = {
        type: 'doughnut',
        SOQL:'SELECT MailingState label, Count(Id) value FROM Contact WITH SECURITY_ENFORCED GROUP BY MailingState LIMIT 100',
options: {
            title: {
                display: true,
                text: 'Number of Members'
            }
        }
    };
    renderedCallback() {
        if (this.isChartJsInitialized) {
            return;
        }
        this.isChartJsInitialized = true;
        Promise.all([
            loadScript(this, chartjs)
        ]).then(() => {
            const ctx = this.template.querySelector('canvas.linechart').getContext('2d');
            this.chart = new window.Chart(ctx, this.config);
            this.chart.canvas.parentNode.style.height = '100%';
            this.chart.canvas.parentNode.style.width = '100%';
        }).catch(error => {
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error loading ChartJS',
                    message: error.message,
                    variant: 'error',
                }),
            );
        });
    }

}

What am I doing wrong?  Thank you
I am trying to build SOQL query displaying credit summary for a particular student. We're on EDA so we're trying to use the Course, Course Offering, Course Connection, and Contact objects to generate this. 
Here is query that displays information we need, but only for courses particular student enrolled. We would need to add course information for courses that student is not enrolled.

select (SELECT hed__Course_Offering__r.hed__Course__r.Subject__c,
hed__Course_Offering__r.hed__Course__r.Catalog_Number__c,
hed__Course_Offering__r.hed__Course__r.Name,
hed__Course_Offering__r.hed__Course__r.hed__Credit_Hours__c, hed__Course_Offering__r.hed__Course__r.Course_Name_in_Native_Language__c,
Letter_Grade__c
FROM hed__Student_Course_Enrollments__r where Subject__c ='GDBA' and Catalog_Number__c LIKE '71%')  
from Contact where Id='0031I00001NcWIBQA3'

I also tried this query, but information is not distinct and not properly formatted:

SELECT  hed__Course__r.Subject__c,
hed__Course__r.Catalog_Number__c,hed__Course__r.Name, hed__Course__r.hed__Credit_Hours__c,
hed__Course__r.Course_Name_in_Native_Language__c,
(Select Letter_Grade__c  from hed__Course_Enrollment__r where hed__Contact__c = '0031I00001NcWIBQA3')
FROM hed__Course_Offering__c Where hed__Course__r.Subject__c ='GDBA' and hed__Course__r.Catalog_Number__c LIKE '71%'

I would appreciate any suggestions.