Tag Archives: delphi

[Pascal Error] YourUnit.pas(224): E2015 Operator not applicable to this operand type

I’ve got this error when was concatinating stings to build pl/sql call. Here’s an example code:

      sql := 'begin '  +
        packageName + '.calc_report(' +
          ' in_dateend=>to_date('''+ LMRFrm.a_Date2_i + ''',''dd/mm/yyyy''),' +
          ' in_code_list=>''' + LMRFrm.a_ListCat_i + ''',' +
          ' in_currency=>''' + LMRFrm.a_currency + ''',' +
          ' in_kr=>''' + LMRFrm.a_kr + ''',' +
          ' in_vseason=>''' + LMRFrm.a_season + ''',' +
          ' in_level=>''' + IfThen( ( 1 = LMRFrm.a_family_agg ), 'FAMILYSC', 'SC' ) + ''',' +
          ' in_filter=>''' + LMRFrm.a_filter + ''',' +
          ' in_report_code=>''' + LMRFrm.a_tpl_code + ''',' +
          ' in_version=>''' + IfThen( _useDevPackage , 'DEV' , 'PROD' ) + ''',' +
          ' in_week_data=>''' + IfThen( ( 1 = LMRFrm.a_week_data) , 'WEEK_DATA ', '' ) + IfThen( ( '1' = LMRFrm.a_show_sparks ), 'TRENDS ', '' ) +  IfThen( ( 1 = LMRFrm.a_full ) , 'FINANCIAL ', '' ) + ''',' +
          ' in_cache_options=>''' + IfThen( LMRFrm.a_use_cache, '', 'BYPASS' ) + ''''
          + ' ); '
          + packageName + '.create_xls( ''' + LMRFrm.a_tpl_code + ''',''' + IfThen( _useDevPackage , 'DEV' , 'PROD' ) + ''');'
          + packageName + '.fill_tmp_lmr_flat; ' + // tmp_lmr_flat используется для выгрузки картинок
      + 'end;';

Can you spot an error? Don’t think you can do it at a glance. Neither could I. So I had to comment line after a line till I found an extra plus sign near the last comment.
So the error was saying: I can not increment the string that I’ve build so far. Strings are not numbers dude.
‘Operator not applicable to this operand type’ is not very informative message. And it came without pointing to the exact line. As always.

Delphi: Most useful keyboard shortcuts

Here are most useful keyboard shortcuts for Delphi IDE, that I extracted from this wiki (some of these I did not know before).

Shortcut Description
Tab In Object Inspector activates incremental search for properties. Press again Tab to move focus to property value
Ctr+E Incremental search (search is an undoable action)
Ctrl+Shift+I Indent the current selected block
Ctrl+K I
Ctrl+Shift+U Unindent the current selected block
Ctrl+K U
Alt+[ Go to matching paranthesis
Alt+]
Alt+Left Browse backward (hotlink history)
Alt+Right Browse forward (hotlink history)
Alt+Up Browse to symbol under editor cursor (invoke a hotlink and add it to the hotlink history)
Ctrl+F5 Add watch
Alt+G Go to line number in editor
Ctrl+Space Invoke code completition
Ctrl+Shift+Space Invoce code parameter hints
Ctrl+Enter Open file at cursor
Ctrl+Shift+Enter Find all references
Ctrl+Shift+Up Navigate to method implementation/declaration
Ctrl+Shift+Down
Ctrl+Alt+P Activate the Tool Palette in filtering mode (start typing, press Enter to drop component)
Ctrl + / Comment line/selected block
Ctrl + Shift + T Add TODO
F11 Invoke Object Inspector window
Shift+Alt+F11 Invoke Structure window
Ctrl+Alt+B Invoke Breakpoints window

By the way, I made this cool looking table with emacs Org mode 😉