How can I set a report parameter based on the print medium type? - ssrs-2008

I need to toggle some presentation in my SSRS Report based on the print medium the report will be generated on.
I have to do this for a bunch of reports (SalesInvoice, SalesConfirm, SalesQuotation).
The problem is I can't find an access point where I have access to both things:
In the SalesInvoiceJournalPost class I have access to the printmedium but not the SalesInvoiceContract
In the SalesInvoiceController class I have access to the SalesInvoiceContract but the printsettings are giving me false values
In SalesInvoiceJournalPost.init I try:
printSettings = SysOperationHelper::base64Decode(chainFormletterContract.parmPrintersettingsFormletter());
printDestinationSettings = new SRSPrintDestinationSettings(printSettings);
if (printDestinationSettings.printMediumType() == SRSPrintMediumType::Email)
{
// Can't access Report Parameter from here
}
In SalesInvoiceController.main I try:
printDestination = formLetterController.parmReportContract().parmPrintSettings();
salesInvoiceContract = formLetterController.parmReportContract().parmRdpContract() as SalesInvoiceContract;
salesInvoiceContract.paramMyValue(
// this is always false because printMedium is always Screen
printDestination.printMediumType() == SRSPrintMediumType::Email
);

Turns out you can get the SRSPrintDestinationSettings from the controller after all with a few degrees of separation. This is SalesInvoiceController.outputReport:
PrintMgmtPrintSettingDetail printSettingDetail;
SRSPrintDestinationSettings printDestinationSettings;
printSettingDetail = formLetterReport.getCurrentPrintSetting();
printDestinationSettings = printSettingDetail.parmPrintJobSettings();
salesInvoiceContract.paramMyValue(
printDestinationSettings.printMediumType() == SRSPrintMediumType::Email
);

Related

Need to change Access Control of Published Items though api

In Smartsheet I have downloaded Published Items list from user management. Using this list I need to change the Access control (Public/Organization) value through api. Please help. Thanks
Depending on the type of object you're updating (Sheet, Report, or Dashboard), the operations you'll use are as follows:
Set Sheet Publish Status
Set Report Publish Status
Set Dashboad (Sight) Publish Status
I've included some code examples below (taken nearly verbatim from those you'll find in the docs I've linked to above.)
One additional note: You'll notice that the values written to the Published Items list that you manually export from Smartsheet differ from the values used by the API. For example, the Access Control column of exported data contains values like Organization and Public -- where as the corresponding values used by the API are ORG and ALL.
Example #1: SHEET --> Set ReadOnlyFullAccessibleBy to ALL, ReadWriteAccessibleBy to ORG
SheetPublish sheetPublish = new SheetPublish();
sheetPublish.ReadOnlyLiteEnabled = false;
sheetPublish.ReadOnlyFullEnabled = true;
sheetPublish.ReadOnlyFullAccessibleBy = "ALL";
sheetPublish.ReadWriteEnabled = true;
sheetPublish.ReadWriteAccessibleBy = "ORG";
sheetPublish.IcalEnabled = false;
smartsheet.SheetResources.UpdatePublishStatus(
4583614634583940, // sheetId
sheetPublish
);
Example #2: Report --> Set ReadOnlyFullAccessibleBy to ORG
ReportPublish reportPublish = new ReportPublish();
reportPublish.ReadOnlyFullEnabled = true;
reportPublish.ReadOnlyFullAccessibleBy = "ORG";
smartsheet.ReportResources.UpdatePublishStatus(
1653087851556740, // reportId
reportPublish
);
Example #3: Dashboard (Sight) --> Set ReadOnlyFullAccessibleBy to ALL
SightPublish publish = new SightPublish();
publish.ReadOnlyFullEnabled = true;
publish.ReadOnlyFullAccessibleBy = "ALL";
smartsheet.SightResources.SetPublishStatus(
5363568917931908, // sightId
publish
);

IPython script runs on Spotfire Client, not Spotfire Web

I have the following python script (reduced, but the rest of it performs similar actions):
from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Data import *
#assign default values for prompts if needed
if Document.Properties['cannedKPISelected'].isspace():
Document.Properties['cannedKPISelected'] = 'GS'
if Document.Properties['cannedTimeSelected'].isspace():
Document.Properties['cannedTimeSelected'] = 'Month'
#determine which type of viz needs displayed based on a flag in the data
tableName='PrimaryDataTable'
columnToFetch='displayPercentageFlag'
activeTable=Document.Data.Tables[tableName]
rowCount = activeTable.RowCount
rowsToInclude = IndexSet(rowCount,True)
cursor1 = DataValueCursor.CreateFormatted(activeTable.Columns[columnToFetch])
for row in activeTable.GetRows(rowsToInclude,cursor1):
rowIndex = row.Index
percentageNeeded = cursor1.CurrentValue
break
#create consumer report
for page in Document.Pages:
for viz in page.Visuals:
if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
if Document.Properties['coffeeReportSelected'] == 'Brand Category by Market':
if Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Month' and percentageNeeded == 'Y':
visualContentObject = viz.As[VisualContent]()
visualContentObject.MeasureAxis.Expression = 'Sum([GS Month]) as [GS Mnth]'
visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand Category] NEST [MARKET] as [Market]>'
visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
visualContentObject.ShowColumnGrandTotal = True
visualContentObject.ShowColumnSubtotals = True
visualContentObject.ShowRowGrandTotal = False
visualContentObject.Title = 'Monthly GS by Brand, Market'
visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
visualContentObject.CellWidth = 125
Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Month],0)))'
elif Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Quarter' and percentageNeeded == 'Y':
visualContentObject = viz.As[VisualContent]()
visualContentObject.MeasureAxis.Expression = 'Sum([GS Quarter]) as [GS Qtr]'
visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand] NEST [MARKET] as [Market]>'
visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
visualContentObject.ShowColumnGrandTotal = True
visualContentObject.ShowColumnSubtotals = True
visualContentObject.ShowRowGrandTotal = False
visualContentObject.Title = 'Quarterly GS by Brand, Market'
visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
visualContentObject.CellWidth = 125
Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Quarter],0)))'
So on and so forth.
This script (and others) run perfectly fine in the client. It does not run in the web. The web will say processing, then say ready (in the bottom left corner), all while doing nothing (no error, nothing). A few other scripts that I have in the same analysis run perfectly fine.
I know there are some limitations on IPython scripts on the web for security reasons, but I am only building a table. This cant be restricted can it? Web server logs are not capturing anything out of the ordinary.
We are on Spotfire 7.6
UPDATE: It seems to be due to this: if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':. This is because IDs are different between Web and Client unfortunately. Knowing my title changes as well, any ideas on what I could reference a visualization by that stays the same between client and web?
Because Spotfire changes IDs of a vis depending on whether it is on the web player vs the client, the script was not working as intended. I simply added the vis as a parameter instead of relying on the script to go and locate the correct vis. When the name of the vis changes, the parameter is updated correctly so it is still dynamic.
Could you just figure out what the index is on the current visual and refer to it that way?
Try something like:
Replace this line:
if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
With:
if viz[0] (or whatever the index is)
Not sure if this is what you had in mind, but I believe this will give you a way to refer to the visualization without having to use an ID.

Outlook form VBScript for controls

I've created an Outlook form with several bound controls. I would like one of the check boxes when checked to make two text areas and their labels visible, then not be visible if the check box is unchecked. The controls that I want to make visible have the initial state of not-visible. I'm stuck on the VBScript syntax. I've been using Sue Mosher's Outlook programming book, but I'm a newby and I'm not getting it. I'd appreciate any help with this. I'm using Outlook 2010 on a Windows 7 machine. Thanks!
Here's my code:
Sub Item_PropertyChange(byVal Name)
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("Message")
Set ckWGC = objPage.Controls("ckWGC")
Set lblState = objPage.Controls("lblState")
Set WGCState = objPage.Controls("WGCState")
Set lblCountry = objPage.Controls("lblCountry")
Set WGCCountry = objPage.Controls("WGCCountry")
If ckWGC.Value = True Then
lblState.Visible = True
WGCState.Visible = True
lblCountry.Visible = True
WGCCountry.Visible = True
Else
lblState.Visible = False
WGCState.Visible = False
lblCountry.Visible = False
WGCCountry.Visible = False
End If
End Sub
You would want to handle the CheckBox.Change event to capture when the user has checked or unchecked it.
Private Sub CheckBox1_Change()
End Sub

Reading a hidden text in Word

I use the following to read hidden text.
Globals.ThisAddIn.Application.ActiveDocument.Content.TextRetrievalMode.IncludeHiddenText = true;
var Text = Globals.ThisAddIn.Application.ActiveDocument.Content.Text;
But it doesn't return hidden text. Moreover, if I check TextRetrievalMode.IncludeHiddenText, it's still false - my statement is ignored but it doesn't throw any exception.
How to read hidden text please ?
Accessing the text retrieval mode like in your sample will always return a fresh Range object with the default configuration. You need to get a range object, set the TextRetrievalMode on that object and then get the text from that same object:
var range = Globals.ThisAddIn.Application.ActiveDocument.Range();
range.TextRetrievalMode.IncludeHiddenText = true;
var text = range.Text;

ActiveReports multi columns detail

My main report includes a subreport in the detail section.
This subreport is designed as follow:
ghHeader1
ghHeader1.ColumnLayout = false; // this header span accross both detail columns
ghHeader1.NewColumn = None
ghHeader1.NewPage = None
ghHeader1.RepeatStyle = OnPage
ghHeader2
ghHeader2.ColumnLayout = true; // this header is specific to each columns of the detail section
ghHeader2.NewColumn = None
ghHeader2.NewPage = None
ghHeader2.RepeatStyle = None
ghHeader2.ColumnGroupKeepTogether = true
ghHeader2.GroupKeepTogether = true
ghHeader2.KeepTogether = true
detail Section
detail.ColumnCount = 2
detail.ColumnDirection = DownAcross
detail.NewColumn = None
detail.NewPage = None
gfFooter2
gfFooter2.NewColumn = After
gfFooter2.NewPage = None
gfFooter2.ColumnLayout = true
gfFooter1
gfFooter1.NewColumn = None
gfFooter1.NewPage = None
gfFooter.ColumnLayout = false
Now, my problem is that with this configuration, when the second column is printed, instead of adding a new group under the first printed column (on the left of the page) it creates a new page even if there is enough space to print the group on the same page.
How can I make the next group print on the same page in the first column ?
I'm using ActiveReports 7.1.7572.
Thanks.
It seems that the issue is being caused due to the setting of "GroupKeepTogether" property. If you will check the details about this property here, you will notice that enabling this property attempts to fit the groupheader and its footer on the same page. If they do not fit then it moves the complete section to the next page.
I tested this issue by creating a similar report but unfortunately could not reproduce the issue. Should you require further assistance, you can post your issue over the GrapeCity support forums.