javascript

edited 5:12PM in FastReport VCL 5
Does anyone use javascript in their reports? I would be interested in seeing a snippet of code. I've had luck using C++ but I don't know the language so I can't get very far. For some reason js won't do anything, not even an alert box.

This is where I'm at. Please excuse the formatting, the editor makes formatting burdonsome:



<!DOCTYPE html>
<html>
<body>
<script>

import "unit1.js", "unit2.js" // What are we importing? The FR guide glosses over this very quickly and doesn't offer really any help.

// Revision variable is the 3rd field down
// Cost variable is the rectangle cost created by sigmanest

function Cost() {
var revision = <WO-PartDetail."RevisionNo">;
var cost = <WO-PartDetail."PartUnitPriceRect">;
var PartCost;

// If the revision field is NOT empty

if (revision != null) {
PartCost = <WO-PartDetail."RevisionNo">;

// If the revision field is empty, the rectangle price will be used

} else {
PartCost = <WO-PartDetail."PartUnitPriceRect">;
}
}

</script>
</body>
</html>

Comments

  • gpigpi
    edited 5:12PM
    Use for example:
    function MasterData1OnBeforePrint(Sender)
    {
      ShowMessage("test");         
    }
    
  • edited 5:12PM
    gpi wrote: »
    Use for example:
    function MasterData1OnBeforePrint(Sender)
    {
      ShowMessage("test");         
    }
    


    Thank you for taking the time to reply. Unfortunately this code doesn't do anything on this end. Are script/html tags required...or is that all of the code needed? Does something have to be put onto the page tab to make it run code? I've even tried the 'hello world' tutorial directly from the documentation (in C...they bailed on Javascript after the first paragraph) and it won't work. There has to be an on switch somewhere(?)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.