Question Hieu Dien Nguyen · Nov 29, 2018

Hello everyone,

I try excuting a SQL Query like this SELECT ID, CompanyName FROM Company WHERE CompanyName LIKE 'condition' 

But if I want to search CompanyName have special char %, ex: '100% Co' , 'Group of Mr.%', 'The %TaxProp'...

How can I take % to query, with  

SELECT ID, CompanyName FROM Table1 WHERE CompanyName LIKE '%%%' 

it'll get all record in table.

Someone give me an idea. Thanks so much!

5
0 1077
Question Hieu Dien Nguyen · Oct 4, 2018

Hi everyone,

I need submit a object have a json string as property of class, but I get an issue, object can't save to SQL table if I take json data to json property. I try making a test class with only json property and get the same issue, no data row in SQL table after run ClassMethod . Some one know what's problem, please help me. Here my test class:

Class DEMO.
2
0 926
Question Hieu Dien Nguyen · Aug 23, 2018

Hello Everyone,

I have a healthshare web application with production, I try to make a field in basic setting of business service, and I would like to set a string to DISPLAYLIST and VALUELIST of that Property (string maked by query to sql table). I code the same here but it's syntax incorrect in DISPLAYLIST = GetTypeDisplay(), VALUELIST = GetTypeValue(). Someone know a best way to solved my problem? Thanks so much!

Class Demo.RegDataService Extends Ens.BusinessService
{

Property xmlTagName As %String(DISPLAYLIST = ",EDocument", VALUELIST = ",Demo.EDocument");

Property PrdType As %String(DISPLAYLIST = GetTypeDisplay(), VALUELIST = GetTypeValue());

Parameter SETTINGS = "PrdType:Basic";

Parameter ADAPTER = "EnsLib.File.InboundAdapter";

ClassMethod GetTypeDisplay() As %String
{
    s result = ""
    &sql(declare CC1 cursor for
    SELECT TypeName INTO :typename FROM Demo_Data.PrdType)
    
    &sql(open CC1)
    &sql(fetch CC1)
    
    while(SQLCODE=0)
    {
        s result = result_","_typename
        &sql(fetch CC1)
    }
    &sql(close CC1)
    q result
}

ClassMethod GetTypeValue() As %String
{
    s result = ""
    &sql(declare CC2 cursor for
    SELECT TypeId INTO :typeid FROM Demo_Data.PrdType)
    
    &sql(open CC2)
    &sql(fetch CC2)
    
    while(SQLCODE=0)
    {
        s result = result_","_typeid
        &sql(fetch CC2)
    }
    &sql(close CC2)
    q result
}
8
0 1806