• Page:
  • 1
  • 2

TOPIC: Command Line Replacements

Command Line Replacements 11 Sep 2007 20:12 #24

  • aellis
  • aellis's Avatar
Logicity Pro has the unique ability to process command line replacements, a feature that will thrill systems integrators. This feature is best described using an example. Let's say you have an ERP system with a Sales Orders module and you also have written a custom Crystal Report that requires the sales order number as a parameter. If your ERP system supports VB scripting or any other method of obtaining information about the data currently on the screen, you can use command-line variable replacement to call your custom Crystal Report and tell it "fill in the sales order number parameter with the sales order currently on the screen". Here are the steps to use command line replacements:

1. Obtain a copy of Logicity Pro for each system that needs to use this feature.
2. Choose a report file that has a parameter that you'd like to fill in from the command line. For this example I am going to say I have a sales order report that has a parameter for Sales Order ID.
3. Develop a Logicity Solution for this report and specify the parameter with a value of %SALES_ORDER%. This value can be anything you choose as long as it has no spaces and is enclosed in percent signs.
4. Now test the command line replacements from a command line first:

"C:\Program Files\SaberLogic\Logicity\Logicity Desktop.exe" "C:\Test.rrd" SALES_ORDER=CO-12345

Where C:\Test.rrd is the path to your RRD file and CO-12345 is the value you want to substitute in the RRD for %SALES_ORDER%.

Using this methodology, integrations with systems is vastly simplified. Any system supporting some sort of VBA macro layer can use code similar to the following to integrate with on-screen fields:
Dim wshShell, logicity
Set wshShell = CreateObject ("WSCript.shell")
logicity = """C:\Program Files\SaberLogic\Logicity\Logicity Desktop.exe"""
solution = """V:\Test.rrd"""
replacements = """" _
"ORDER_ID =" ORDER_ID.Text
""""

wshshell.run logicity + " " + solution + " " + replacements, 1, True
Last Edit: 05 Dec 2008 12:19 by aellis.
The administrator has disabled public write access.

Re:Command Line Replacements 05 Dec 2008 08:13 #335

  • perherman
  • perherman's Avatar
what is the complete syntax for command line replacements.

We have an application that utilises CR 8, with our own .dll that sends parameters to the reports. We would like to use CR 2008, but need quite sophisticated parameters (dates, numerics, alpha, range of values, appending to the sql, etc

PerOlof Hermansson

This email address is being protected from spambots. You need JavaScript enabled to view it.
The administrator has disabled public write access.

Re:Command Line Replacements 05 Dec 2008 12:17 #336

  • aellis
  • aellis's Avatar
Just to be sure we are on the same page here - command line replacements is a Logicity-only feature and doesn't exist in Crystal Report 2008 by itself. It is a custom bit of code we wrote that allows command line arguments to fill in parameters in your Logicity Solution File. Also, it is only present in Logicity Pro.

That said, the syntax for command line replacements is simply what is displayed in the first post - you simply make up a variable name enclosed in percent signs anywhere within Logicity Solution Builder. So if you wanted to do a date range, for example, you might set the beginning of the date range to %BEGIN% and the ending to %END%. Now when you execute this Logicity Solution File you will need to provide a command line argument defining the value for each of these variables you've defined. Where I think Logicity may fall short based on your post would be appending to SQL...we don't currently have any facility to handle that.

Hope this helps,
Adam
The administrator has disabled public write access.

Re:Command Line Replacements 06 Dec 2008 17:53 #337

  • perherman
  • perherman's Avatar
Hi,

I just bought Logicity, and received the licenscode, and registered it.

I like what I see so far, but I cannot find anything about command line replacements (to send parameters to the report) anywhere in the manual that I downloaded.

Is there any more that what you have posted in this Tips and Tricks-thread?

Thanks,


Per-Olof
The administrator has disabled public write access.

Re:Command Line Replacements 08 Dec 2008 13:11 #338

  • aellis
  • aellis's Avatar
Unfortunately the only documentation for this feature exists on this post currently. We'll work on that, but in the meantime is there anything I can clear up for you on how to make use of the feature?
The administrator has disabled public write access.

Re:Command Line Replacements 08 Dec 2008 13:55 #339

  • perherman
  • perherman's Avatar
We currently use command line parameters to CR 8.5 frequently, so here are a few examples of what we send to our current bridge .dll:

We always send the following basics:
c:\mrptlink.exe report.rpt db_user dp_password

then comes parameters,

one parameter:
BatchNumber (numeric)
SubscriptionCOde (Alpha)
DUeDate (Date)
ActiveMembers: Logical (= 1 or O, numeric?)

two parameters:
SubscriptionCode + SegmentCode

Range of:
BatchNumberFrom BatchNumberTo (numeric)
CreatedDateFrom CreatedDateTo (Date)

When it comes to dates we send them as strings: 'YYYY-MM-DD'

My question is if any of these combinations above need any special consideration?

Otherwise I will start testing, and come back to you with feed-back.

Per-Olof
The administrator has disabled public write access.

Re:Command Line Replacements 08 Dec 2008 14:28 #340

  • perherman
  • perherman's Avatar
First trial:

I enter the following at the command prompt:

"c:\Program Files\Saberlogic\Logicity\Logicity Desktop.exe" "C:\aquila\reports\prislista.rpt" pCOMPANY='Mass Marketing Software AB' pUSER='Per-Olof Hermansson' pCMM_CODE='KOD'

I have tried to replace ' with " or not use any string delimiters, but the result is the same I get a screen asking me to fill out the parameter values.

How do I send the string parameters, I assume that the numeric parameters are sent without any delimiter.

I also get a screen asking for the password (The schema user is saved by default in the report).

Is it possible to sent the password as a parameter?

Per-Olof
The administrator has disabled public write access.

Re:Command Line Replacements 08 Dec 2008 15:34 #341

  • perherman
  • perherman's Avatar
I realise now that I should call for a .RDD file.

However, when I do this with parameters it still runs the report with the parameters that I defined the RDD with.

This when I call the following in the command prompt:


"c:\Program Files\Saberlogic\Logicity\Logicity Desktop.exe" "C:\aquila\reports\prislista.rdd" pCOMPANY='Mass Marketing Software AB' pUSER='Per-Olof Hermansson' pCMM_CODE='KOD2'

I get the report with "MMS AB" (as Company), and "Server" (as user), and with the range on "KOD" rather than "KOD2", i.e. it runs as I defined it in the .rdd.

Somehow the parameters that I add to the command do not change the runtime range of data.

Per-Olof
The administrator has disabled public write access.

Re:Command Line Replacements 08 Dec 2008 20:30 #342

  • aellis
  • aellis's Avatar
Per-Olof,

A couple of things to check here - first off I think you want to use double quotes instead of single quotes around your variable definitions to correctly handle spaces. Next, and this isn't documented anywhere, in order to specify multiple variables you need to separate the string with semi-colons. So here is what your resulting command line would look like:

"c:\Program Files\Saberlogic\Logicity\Logicity Desktop.exe" "C:\aquila\reports\prislista.rdd" pCOMPANY="Mass Marketing Software AB";pUSER="Per-Olof Hermansson";pCMM_CODE="KOD2"

Then you will have all of the following variables available to you within Logicity Solution Builder:

%pCOMPANY%
%pUSER%
%pCMM_CODE%

Let me know how you make out,
Adam
The administrator has disabled public write access.

Re:Command Line Replacements 09 Dec 2008 13:35 #343

  • perherman
  • perherman's Avatar
Very strange: Today when I try, nothing works.

I can call "c:\Program Files\Saberlogic\Logicity\Logicity Desktop.exe" and it will ask me to open a file.

But when I put: "c:\Program Files\Saberlogic\Logicity\Logicity Desktop.exe" "C:\aquila\reports\AQUILA.rdd" pCOMPANY="Mass Marketing Software AB";pUSER="Per-Olof Hermansson";pCMM_CODE="KOD2"

nothing happens, and whatever I do, change parameters, or even try to run the report without parameters, id does not call or open a program.


Per-Olof
The administrator has disabled public write access.
  • Page:
  • 1
  • 2