(RPG) Offline : SQL Select statement
Posted: Fri Apr 24, 2015 8:19 am
Hi,
I have an offline program and a local database that I need to read from. The local database is a multilingual file where I get the equivalent multilingual text depending on the chosen language code. I used the SQL Select statement but it doesn't seem to be working as I keep getting null values.
Here's my SQL statement:
LRNG_SetProperty('/Form.Vars.PGMNAM' : 'MX3LOGON');
LRNG_SetProperty('/Form.&.TBL' : 'MultiLingual');
LRNG_SetProperty( '/Form.Fields.BTN_LOGIN.Text.&.SQL' :
'Select MLTXTVAL from MultiLingual where ' +
'MLLANGID = (&(VAR:PRMLNG)) and ' +
'MLPGMNAM = (&(VAR:PGMNAM)) and ' +
'MLFLDNAM = ''BTN_LOGIN''');
where &(VAR:PRMLNG) = 'ENG' and &(VAR:PGMNAM) = 'MX3LOGON'.
I also tried another version of Select statement, this time hard-coding the Language ID (MLLANGID) and Program Name (MLPGMNAM):
LRNG_SetProperty( '/Form.Fields.BTN_LOGIN.Text.&.SQL' :
'Select MLTXTVAL from MultiLingual where ' +
'MLLANGID = ''ENG'' and ' +
'MLPGMNAM = ''MX3LOGON'' and ' +
'MLFLDNAM = ''BTN_LOGIN''');
In both cases, my Select statements are not returning anything. The Multilingual file contains the records I should be getting. But in the client log, the Select statement appeared like this:
Line 2328: 2015-04-13 06:19:54.658 LongRange[763:2154413] _StatementRowIterator::R lansa::sqlite::Statement::execute():422: DB:SQL: SELECT "rowid" FROM "MultiLingual" WHERE "mlfldnam"=? AND "mllangid"=? AND "mlpgmnam"=?
The MLFLDNAM, MLLANGID and MLPGMNAM all have null values.
The MultiLingual file has these records, to list a few:
MLLANGID -- MLPGMNAM -- MLFLDNAM -- MLTXTVAL
ENG MX3LOGON BTN_LOGIN Login
ENG MX3LOGON BTN_HOME Home
ENG MX3LOGON BTN_SUBMIT Submit
I don't know what I'm doing wrong, but I am not getting anything in my SQL statement. Any help would be greatly appreciated.
Thanks in advance.
Rocel
I have an offline program and a local database that I need to read from. The local database is a multilingual file where I get the equivalent multilingual text depending on the chosen language code. I used the SQL Select statement but it doesn't seem to be working as I keep getting null values.
Here's my SQL statement:
LRNG_SetProperty('/Form.Vars.PGMNAM' : 'MX3LOGON');
LRNG_SetProperty('/Form.&.TBL' : 'MultiLingual');
LRNG_SetProperty( '/Form.Fields.BTN_LOGIN.Text.&.SQL' :
'Select MLTXTVAL from MultiLingual where ' +
'MLLANGID = (&(VAR:PRMLNG)) and ' +
'MLPGMNAM = (&(VAR:PGMNAM)) and ' +
'MLFLDNAM = ''BTN_LOGIN''');
where &(VAR:PRMLNG) = 'ENG' and &(VAR:PGMNAM) = 'MX3LOGON'.
I also tried another version of Select statement, this time hard-coding the Language ID (MLLANGID) and Program Name (MLPGMNAM):
LRNG_SetProperty( '/Form.Fields.BTN_LOGIN.Text.&.SQL' :
'Select MLTXTVAL from MultiLingual where ' +
'MLLANGID = ''ENG'' and ' +
'MLPGMNAM = ''MX3LOGON'' and ' +
'MLFLDNAM = ''BTN_LOGIN''');
In both cases, my Select statements are not returning anything. The Multilingual file contains the records I should be getting. But in the client log, the Select statement appeared like this:
Line 2328: 2015-04-13 06:19:54.658 LongRange[763:2154413] _StatementRowIterator::R lansa::sqlite::Statement::execute():422: DB:SQL: SELECT "rowid" FROM "MultiLingual" WHERE "mlfldnam"=? AND "mllangid"=? AND "mlpgmnam"=?
The MLFLDNAM, MLLANGID and MLPGMNAM all have null values.
The MultiLingual file has these records, to list a few:
MLLANGID -- MLPGMNAM -- MLFLDNAM -- MLTXTVAL
ENG MX3LOGON BTN_LOGIN Login
ENG MX3LOGON BTN_HOME Home
ENG MX3LOGON BTN_SUBMIT Submit
I don't know what I'm doing wrong, but I am not getting anything in my SQL statement. Any help would be greatly appreciated.
Thanks in advance.
Rocel