Quantcast
Channel: SCN : Discussion List - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2881

Appeon SetSQLSelect - PB 12.5

$
0
0

Greetings All,

 

I have been working on an application that worked fine as a PowerBuilder Web Application.  I had to retool it for another line of business with the intent of publishing it using Appeon.

 

So today I sent out a big email telling everyone that it is read for review and then thought, 'Oh, I better publish this update with Appeon so they can see it.'  Well that didn't work out too well.

 

I am essentially creating a vertical datawindow because I need to have control over which price elements that certain individuals see.  So I create the SQL dynamically and then use that to create the DW dynamically with the necessary data.  Works great in native PB and in a PB web application using IE 9.0.

 

Wondering if I just stepped off the cliff.  Feels like it.

 

If anyone can shed some light on this or otherwise point me in the right direction, it will be appreciated.

 

Thank you!!

 

Paul

 

I have code that builds the SQL (with parameters) and executes in the open event of my window as:

 

//Build the sql for the VC Closeout rate elements

string sql

sql = udf_build_trip_closeout_rate_element_visible_sql_vc(confo)

 

 

int result

result = dw_vc_charges.setsqlselect(sql)

if result = 1 then

  dw_vc_charges.settransobject(sqlca)

  rows = dw_vc_charges.retrieve(confo)

else

  messagebox("setsqlselect result",string(result))

end if

 

I found something in the Appeon Troubleshooting Guide and it seems like it is saying taht SetSQLSelect cannot have parameters?

 

7.2.4.177 Error 13012

Priority 0

Error Message

User SQL cannot have parameters in Verify SQL Command.

Possible Cause

When using SetSQLSelect in the DataWindow to modify the SQL statement, SetSQLSelect

cannot contain parameters.

 

Here is the code that I am using to build the SQL statement:

 

string sql

 

 

//messagebox("Called Function","udf_build_trip_closeout_rate_element_visible_sql")

 

 

sql = "SELECT 'Base Rate: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.basic_rate_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Gratuity: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.tips_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Tolls: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.tolls_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Parking: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.parking_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

 

 

//FUEL //per Tim in OCT 2015 NO AFFILIATE CAN CHARGE FUEL

//if fuel_hide = 'N' then

// sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

//'~r~n' + '~r~n' + '' + &

//'~r~n' + '~r~n' + "SELECT 'Fuel: ' as DESCRIPTION," + &

//'~r~n' + '~r~n' + 'voucher_current.fuel_surcharge_dr as AMOUNT' + &

//'~r~n' + '~r~n' + '    FROM voucher_current' + &

//'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

//'~r~n' + '~r~n' + ''

//end if

 

 

//STC

if stc_hide = 'N' then

  sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'STC: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.stc_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

end if

 

 

//MEET/GREET

if meet_greet_hide = 'N' then

  sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Meet/Greet: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.m_g_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

end if

 

 

//ELMN/HOLIDAY

//For EMLN and Holiday charge, Aleph will have to add them together before they populate the _dr rate elements in the operator table

if emln_hide = 'N' then

  sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'EMLN/Holiday: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.ot_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

end if

 

 

//AIRPORT FEE

if airport_fee_hide = 'N' then

  sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Airport Fee: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.airport_fee_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

end if

 

 

//STOPS FEES

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Stops Charges: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.stops_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

//WAIT CHARGES

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Wait Charges: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.wt_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

//MISC CHARGES

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Misc. Charges: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.miscellaneous_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

//DISCOUNT

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Discount: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.discount_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

//WC

//need to check if trip is in Manhattan

//if trim(pu_city) = 'New York' AND trim(dest_county) = 'New York' then

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'NYC Workers Comp: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.wc_charges_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

//end if

 

 

//TAX

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Tax: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.sales_tax_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

//NET

sql = sql + '~r~n' + '~r~n' + 'UNION ALL' + &

'~r~n' + '~r~n' + '' + &

'~r~n' + '~r~n' + "SELECT 'Total: ' as DESCRIPTION," + &

'~r~n' + '~r~n' + 'voucher_current.net_dr as AMOUNT' + &

'~r~n' + '~r~n' + '    FROM voucher_current' + &

'~r~n' + '~r~n' + '   WHERE voucher_current.confirmation_no = ~'' + confo + '~''  + &

'~r~n' + '~r~n' + ''

 

 

 

 

 

 

 

 

//MESSAGEBOX("SQL IS",SQL)

 

 

// airport_pu_fee_hide = rev.getitemstring(1, "airport_pu_fee_hide")

// airport_do_fee_hide = rev.getitemstring(1, "airport_do_fee_hide")

  sql = sql + ";"

  return SQL


Viewing all articles
Browse latest Browse all 2881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>