Replies: 1 comment
-
Hello @Nawksen, Very exciting that you are trying things out and eager to get started! We are still relatively early in the development and i I would suggest you take a look at the dynamic archive provider and how you can create queries with the dot-syntax similar to how you would with the SearchEngine. Priorities are just a way to group criterias in the resulting SQL query, so you should be able to do the same with the dot-syntax. If you need anything more specific then I am more then happy to assist if you have a concrete example I can //E |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey hey!
I might ask a few "What's the best practice" here, since the code library im building now will be in MANY solutions after TypeScript goes live, so, better safe then sorry (Sorry = inefficient code that will haunt your azure bills)
So, since we are about 16 developers building SearchEngines multiple times a day, that seems to be a perfect opportunity to streamline a bit in typescript.
(And yes, In this case, im using a getArchiveListByColumns2Async, will build another one for the SimpleContac etct)
Can you see any approvements to this code when it comes to efficiency?
################
function printLine(value){
context.result.body += value + "\r\n";
};
const agent = soApi.getArchiveAgent();
async function searchEngine(fields : Set, criteria : string, sortOrder? : string, maxRows? : number)
{
const fieldsData: string[] = Array.from(fields);
const fieldString: string = Array.from(addFields).join(",");
let rowLimit = 999;
if(maxRows !== undefined)
rowLimit = maxRows;
var response = result.map(item => {
const extractedData: any = {};
fieldsData.forEach(field => {
if (item.columnData[field]) {
extractedData[field] = item.columnData[field].displayValue;
}
});
return extractedData;
});
return response;
}
const addFields = new Set();
addFields.add("contact.contact_id");
addFields.add("contact.name");
addFields.add("contact.category_idx");
var searchEngineResults = await searchEngine(addFields,"contact.contact_id gt 5 AND contact.contact_id lt 15");
searchEngineResults.forEach(item => {
printLine(item["contact.contact_id"]);
});
################
Also, is there any documentation or examples on how to handle Priorities in the getArchiveAgent?
getCompanies.addCriteria("contact.contact_id","Equals","2","And", );
Beta Was this translation helpful? Give feedback.
All reactions