The Query Expression component enables users to write queries using a unified syntax in both JavaScript and C#. This allows users to seamlessly switch between backend (C#) and frontend (JavaScript) development without needing to rewrite the query logic. By maintaining consistency in syntax, developers can easily copy queries from C# and use them directly in JavaScript, and vice versa, ensuring maximum flexibility and reusability.
<script>
var query = new QueryExpression('Account ');
query.Columns.AddColumns("Name", "Address", "PhoneNumber");
var condition= new ConditionExpression(
' Account', //entity
' Status',//column
ConditionOperator.EQUAL, //operator
'1' //value
); query.Criteria.AddCondition(condition)
</script>
<script>
var query = new QueryExpression(viewSql,” Account “);
query.Columns.AddColumns("Name", "Address", "PhoneNumber");
var condition= new ConditionExpression(
' Account', //entity
' Status',//column
ConditionOperator.EQUAL, //operator
'1' //value
);
query.Criteria.AddCondition(condition)
</script>
const viewExpression= query.GenerateView('custom_view');
var result = await executionContext.webApi.retrieveMultipleRecordsWithJoin(entityId, viewExpression);
var queryExpression = await query.ToString();
var result = await _organizationConnector.RetrieveMutlipleWithReferencesAsync(queryExpression, "Account");