Manuais
PHC GO Funções SDK - Utils
 

Utils


 
 

 

 

Description

This function allows the user to execute SQL code.
 

Return Function

A PHCResult object.
 

Parameters

 
Name Description Type
query The query to apply String
 

Example


The following example returns the list of all active billing series.

let query = new QueryVO(); query.entityName=TABLES.TD;
query.SelectItems.push(FIELDS.TD_NDOC);
query.SelectItems.push(FIELDS.TD_NMDOC);
query.SelectItems.push(FIELDS.TD_TIPOSAFT);

var filter = new FilterItem();
filter.filterItem = FIELDS.TD_INACTIVO;
filter.comparison = Comparison.EQUAL;
filter.valueItem = 0;
query.filterItems.push(filter);

// Declare array to keep the result
var tdList = [];
sdk.runQuery(query).subscribe(value => {
if(PHCResult.ok(value) &&!!value.result.length){
value.result.forEach(td => {
tdList.push(td);
})
}
});


 
 

Description

This function allows the user to execute SQL code.
 

Return Function

A PHCResult object.
 

Parameters

 
Name Description Type
query The query to apply String
 

Example


The following example returns the list of all active billing series.

let query = new QueryVO(); query.entityName=TABLES.TD;
query.SelectItems.push(FIELDS.TD_NDOC);
query.SelectItems.push(FIELDS.TD_NMDOC);
query.SelectItems.push(FIELDS.TD_TIPOSAFT);

var filter = new FilterItem();
filter.filterItem = FIELDS.TD_INACTIVO;
filter.comparison = Comparison.EQUAL;
filter.valueItem = 0;
query.filterItems.push(filter);

// Declare array to keep the result
var tdList = [];
sdk.runQuery(query).subscribe(value => {
if(PHCResult.ok(value) &&!!value.result.length){
value.result.forEach(td => {
tdList.push(td);
})
}
});


 
 

Description

Checks if the product is available.
 

Return Function

A logical value indicating whether or not the product is avaiable.
 

Parameters

 
Name Description Type
products Array of products to be checked Products[]
 

Example


const isProductDocumentLicense = sdk.hasProducts([Products.DOCUMENTS])



 

Description

The function downloads the file from the directory based on the name.
 

Return Function

Downloads the file.
 

Parameters

 
Value Description Type
fileName The name of the file in the directory String
 

Example


sdk.runBusinessRuleOnDemand(currentRecord,ENTITY_RULES.U8882_TST).subscribe(value=>{
sdk.downloadFileFromExportDir(value.messages[0].messageCode);
return true});



 

Description

Opens a confirmation pop-up window before performing another action.
 


Return Function

Observable <boolean>.
 

Parameters


Name Description Type
Title Defines a main title String
Question Ask a question String
Cancel Cancel Button String
Ok Accept Button String
 

Example


The following example returns a confirmation pop-up before showing a success message.

1
2
3
4
5
6
sdk.openConfirmationDialog("Hello", "This fully customizable pop-up will return a success message, 
would you like to continue?", "Cancel", "Accept").subscribe(value=>{
if (value === true){
sdk.publishMessage("Success Message", AlertTypes.SUCCESS)
}
return true});