PDA

View Full Version : Integration of a DAI report in a Windows application



danwalsh46
16-Jan-2014, 11:56 AM
I have the following code in a tab view of a data entry view. The report displays, but I have two problems.

1) The filter is not hidden even though the parameter is passed correctly.

2) The "Set pbAllowAdHocCustomizing to False" is not respected.

To work around the second problem, I've turned it off within the report definition.

The first problem is the one I'm most interested in solving.




Object oOpenRequestsTabPage is a dbTabPage
Set Label to "Open Medical Requests"


Object oOpenMedicalRequestsReport is a cDynamicAiReport
Set Size to 198 428
Set Location to 5 5
Set peAnchors to anAll
Set psBasicUrl to "www.MYWEBSITE.org/ai6"
Set psUsername to "USERNAME"
Set psPassword to "PASSWORD"
Set psReportId to "3968"
Set psRepository to "DNMC"
Set peEdition to "Server"
Set pbUseTicketAuthentication to False
Set pbSingleFrame to False
Set pbAllowAdHocCustomizing to False


Procedure RunTheReport
Boolean bIsCreated
String sExpcode
//
Get IsComObjectCreated to bIsCreated
If bIsCreated Begin
// Get Field_Current_Value of JCReps_DD Field Jcreps.Idno to iRepId
Move "UHC" to sExpcode
If (sExpcode <> "") Begin
Send ClearAllFilters
Send AddFilter "EXP_CODE" sExpcode "" True // True to hide filter
Send RunDynamicAiReport
End
Else Begin
// Present a blank page if report is not run
Send ComNavigate "about:blank" 0 0 0 0
End
End
End_Procedure
End_Object

Bob Cergol
16-Jan-2014, 02:35 PM
Dan,

What does the report doc in Dynamic AI show the name of the filter to be?

When columns names are unique -- as they must be in a view, the filter name is almost always the same name. It will be different for date columns involving date parts, or if the same column is used twice as a filter (usually dates).

When column names are not unique -- as often happens in a dyn-join -- then Dynamica AI assigns names to distinguish the which column is used as the filter.

Bob

danwalsh46
16-Jan-2014, 04:59 PM
J4.EXP_CODE is how it's defined in the report. I changed my code as suggested, but still get the same result. The filter works as expected, but it not hidden.

Bob Cergol
16-Jan-2014, 05:17 PM
Can you debug the value of psURL on line 842 of cDynamicAIReport.pkg in the debugger and see how it represents the filter?

I think it should be one or the other of the two shown in the report doc, which the screenshot in your email shows as J4AIQQ046EXP_CODE.

I would try using that as the name in your source code. I've used this capability in the past and it has worked for me.

The pkg hasn't been changed since 2009, however it was written to support any of the then-existing 5 different versions of Dynamic AI: personal, desktop, runtime, server, and enterprise. Today there is only server and enterprise. I found in the package code that the pbAllowAdhocCustomizing was only supported in the "runtime" version. I tested modifying the code to generate the &AH=N parameter in the URL but it had no effect either. So the workaround is to control the adhoc privilege at the user-profile level and/or at the report level. You can also hide the entire navigation pane that contains the tools menu in the report by adding this line to the bottom of the style sheet assigned to the report, which you can override in your program.
#slctorframe { display: none;}

Regards,
Bob

Bob Cergol
16-Jan-2014, 05:30 PM
P.S. When you look at the cDynamicAIReport.pkg you realize it does a few things for you that you could also do yourself, if/when needed to achieve some required result. The package automates the following for you:

1) creates an iFrame object for your Windows application

2) generates a properly formed URL with all the various Dynamic AI supported parameters based on your property values

3) Optionally, implements something called "ticket authentication" that encrypts the URL in a way that hides most of the content and should make it tamper-proof. I manually implemented that same logic in the example webapp: http://dataaccess.com/LiveDynamicAI . The URL doesn't show when you encapsulate the report in a DF object, but it does when you open in a new browser tab or window in a webapp, and of course over the wire.

I mention this because if absolutely necessary you could override the logic the package uses and simply provide your own URL string. I know the visible and hidden syntax for the named filters works when using the names as Dynamic AI shows them in its report doc.

danwalsh46
16-Jan-2014, 09:57 PM
Changing J4.EXP_CODE to J4AIQQ046EXP_CODE does give me the result I originally expected, the filter is now hidden.

I'm interested in hiding the entire navigation panel, but currently don't have a style sheet assigned. Normally my role is getting the pig to the theater and a coworker assumes the responsibility for applying the lipstick. Can you point me in that direction, please?

Bob Cergol
17-Jan-2014, 08:27 AM
Its pretty trivial actually. Just navigate to Administration / Styles / List Styles (system) and pick the one you like. Add the line I gave you to the bottom and save as. (It won't let you overwrite the system styles.) Afterwards you'll have a new "List Styles" menu branch for your styles. Here is also where you can see what numeric ID is assigned to the style sheet.

In the report design you can assign any style sheet you like on both the list and list options tab. When calling the report from a URL or your application you can assign a different style sheet ID.

Bob

danwalsh46
17-Jan-2014, 11:32 AM
I've added a style sheet per your instructions, but still don't get what I expect. I did a save as on the 04 system style sheet and added your code to the bottom:




... code above omitted

#DAST TD, #DASPIVOT TD, .FLTBOX TD
{font:6.5pt Verdana, Arial;}


A {color:BLACK;}
.VR1 {background-color:#FFC8BF;}
.VR2 {background-color:#FDFCDC;}
.VR3 {background-color:#DFFFC8;}


.DROPTA A {color: BLACK; background-color: WHITE;padding-left:10px;padding-right:10px;padding-top:4px;}
.DROPTA A:hover {padding-left:10px;color: BLACK; background-color: GAINSBORO;padding-right:10px;padding-top:4px;}


#slctorframe { display: none;}




and this is my result:

7296

I expected not to see the Go button. Am I still missing something?

Bob Cergol
17-Jan-2014, 12:03 PM
Did you assign the new style sheet to the report? Either hard-coded in report design, or overriding the hard-coded one, with your custom one in your VDF application?

Here's a Job Cost report using Style Sheet "Std 05".
7297
Here's what it looks like in the VDF application overriding that with custom style sheet "VP Cost Sheet" (ID = 8)
7298

Here's the code:


Object oJobCostReport is a cDynamicAiReport
Set Size to 183 512
Set Location to 12 5
Set peAnchors to anAll
Set pbAllowAdHocCustomizing to False
Set pbAllowColumnBasedActions to False
Set pbUseTicketAuthentication to False
Set psReportId to "1892"
Set psRepository to "DNMC"
Set pbSingleFrame to False //test what this does, default is true
Set psListStyle to 8 //VP: Cost Sheet
...


Bob

danwalsh46
17-Jan-2014, 12:24 PM
Oops, I didn't use the ID, I used the Name. It's what I expect now. Thanks.

Bob Cergol
17-Jan-2014, 12:33 PM
Yeah, if it doesn't find such a style sheet, it will default to the one defined in the report design -- rather than not running and giving an error.
Similar to with the filter naming, eh....?