We just converted (Finally) a PB 12.1 application to PB 2019 R2 (build 2328). It works mostly but for one flaw in the compiled code - we store email templates via user settings in an RTE, in SQL server "text" columns.
When we run the app within PB 2019, it properly pulls the RTE and locates the user-selected fields therein, populating a table with new data. When we run in a compile (using PowerGen as the compiler), it doesn't do that.
The code fragment below deletes the contents of the datastore, and repopulates it based on the number of \txfielddef's in the RTE, then saves the new contents of the datastore. For some reason, in the compile, only the delete occurs.
I'm thinking that the compile is missing a DLL or several. Which ones do we need to bundle in the install package to get this to work like it does within PB? Or is there more to this?
Any help is appreciated. Reach out if you'd like clarification.
Code fragment:
// First, delete all in the fields datastore.
ids_email_fields.RowsMove(1, ids_email_fields.Rowcount(), Primary!, ids_email_fields, 1, Delete!)
// Count the number of fields in the passed RTE "arte".
ls_doc = arte.copyrtf( false )
li_flds = 0
li_pos = 0
// Check for "{\txfielddef" ending in either "{" or "\". (When I run through PB's debugger, this works; this might be the culprit in the compile? Because in the compile
do while 1 = 1
li_pos = pos( ls_doc, '{\txfielddef{', li_pos + 1 )
if li_pos = 0 then exit
li_flds ++
loop
li_pos = 0
do while 1 = 1
li_pos = pos( ls_doc, '{\txfielddef\', li_pos + 1 )
if li_pos = 0 then exit
li_flds ++
loop
// If we find at least one, gather its pieces and insert into the datatstore.
if li_flds > 0 then
ls_fld = arte.inputfieldlocate( first! ) //Perhaps this is what's failing?
i = 1
do while i <= li_flds
ll_row = ids_email_fields.InsertRow(0)
ids_email_fields.SetItem(ll_row, "urn", al_urn)
//continue populating the row ll_row
ls_fld = arte.inputfieldlocate( next! )
i ++
loop
end if
li_rc = ids_email_fields.Update()
It worked out. We installed build 2353, recompiled, and tested the compile, and it works as expected. Thanks for the tip!
Scott