Solved

Crystal Reports %appdata% system variable

Posted on 2013-11-12
17
882 Views
Last Modified: 2014-01-10
I am trying to return a file path in a Crystal Report to point an OLE object to a picture file via the Graphic Location functionality, but I can't get it to work using the %appdata% system variable.

When I use an absolute path (C:\Documents and Settings\ . . . . ) it works fine.  

I did read somewhere that Crystal Reports doesnt have access to those variables, but was wondering if anyone knew of a workaround?

Many thanks in advance
0
Comment
Question by:cjohnson300
  • 6
  • 3
  • 3
  • +2
17 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 39641881
What version of Crystal?

mlmcc
0
 

Author Comment

by:cjohnson300
ID: 39641887
11
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39641917
How are you running the reports?

mlmcc
0
 

Author Comment

by:cjohnson300
ID: 39641923
at the moment as i'm still testing, the data is in an Access mdb held locally as is the Crystal report
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39642168
How do you plan to run the reports?

I don't think you can access the system variables.

You could access the value in an application that runs the reports and pass the value to the report in a parameter.  The parameter can then be used in the formula for the object location

mlmcc
0
 

Author Comment

by:cjohnson300
ID: 39642359
unfortunately that's not an option, the report is going to be called from an application but I dont have access to the code of the application.
0
 
LVL 18

Expert Comment

by:vasto
ID: 39642645
If you are using R-Tag viewer you can create a formula like this one:

value = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

Open in new window


Then use this formula as it is shown in this vide0:
http://www.youtube.com/watch?v=ADXiP24N6Fw
(The sample is for current user name , which is another Environment variable)

If you are not using R-Tag viewer you can request a free license from this page:
http://www.r-tag.com/Pages/FreeCrystalReportsViewer.aspx

Another option is to search for a custom UFL (or write one). This one comes with source code so you can just add a new function to return %appdata% : http://www.viksoe.dk/code/u2lwin32.htm

There might be some others on the market, which provide this feature.
I don't think UFL is the best option - if it is paid the price will be similar to a viewer and you will still need to run the report somehow. Also UFLs are usually 32 bits COM objects so you will be restricted to the 32 bits world. However if you are already set with a viewer this will be the only option.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:cjohnson300
ID: 39643944
thanks for the post but I'm not using the r-tag viewer, and i guess if i did i would have to roll it out to every user of my application?
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 39644144
It's not really pretty, but one option might be to store the %appdata% value in a table, and then use a subreport in the report header to read that value and save it in a shared variable, and then use that shared variable to set the location for your image files.

 James
0
 
LVL 22

Accepted Solution

by:
Ido Millet earned 250 total points
ID: 39644445
One of the 3rd-party Crystal UFLs listed at http://kenhamady.com/bookmarks.html#ufl provides a GetEnvironmentVar() function.
0
 

Author Comment

by:cjohnson300
ID: 39644521
how do i use these UFL files?!
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 39644558
A UFL library is a dll file. Once installed (or copied to the appropriate folder), the functions inside that dll become "Additional Functions" inside Crystal Designer, so you can create formulas using them. The UFL I was referring to has ~60 such functions (including the GetEnvironmentVar() function).

You would need to deploy the dll to any machine that runs a report with formulas that rely on these Additional Functions (either using Crystal Designer or any 3rd-party Crystal Viewer Application).

As mentioned above, you can create a UFL yourself.
0
 
LVL 18

Expert Comment

by:vasto
ID: 39645583
Which application are  you using ?

I am confused. You mentioned that you cannot change it but you a referring to it as "my" application. If it is a 3rd party software and doesn't support basic stuff like that, what is the purpose to have it?  As I mentioned, If you are stuck with your current application you need to use an UFL. If you can develop your own UFL this will be fine, but If you are going to implement an existing one you may face the same issue tomorrow ( with another not supported function). If you are going to pay for UFL licenses,  consider the fact that you need to provide it to all users too,  and for almost the same price you can upgrade to R-Tag  (or similar application) and resolve the current and the future issues.
0
 

Author Comment

by:cjohnson300
ID: 39647440
i didnt refer to it as my application, but what happens is that the application invokes Crystal runtime when a report is run, and I'm not sure how i would tell the client machine to use a different report viewer
0
 
LVL 18

Expert Comment

by:vasto
ID: 39648674
Crystal report should be configured before you to be able to run it. The main reason is that connection password is not saved with the report. You will either add few reports to your application and configure them, providing connection information and other settings or you will use Integrated security , which means you should manage user's permission on the database side. Of course you may use database, which does not require login ( like Access) but this will be one of the future problems you will face. So the way how this works is :
 1 administrator will add and configure few reports
 2 the user will open the viewer , select a report and run it

Any viewer will work like this, except the one from SAP, which is not able to refresh the data and for this reason does not require connection info.

It is hard to give you an advice without knowing details about the environment so I would suggest you to contact some of the Crystal reports viewers vendors and  discuss with them the options and the price of the solutions. You can find a list of vendors here : http://kenhamady.com/cru/comparisons/crystal-reports-viewers

As mentioned, I would not recommend UFL , but this is always an option in case you cannot find another solution. If you cannot develop your own and you are ready to purchase a licensed UFL,  contact Ido Millet - his UFL will provide you a way to resolve your current problem and  he has a good reputation for implementing user requests.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now