Monday, July 25, 2011

Creating a Tab Report in Report Studio

Steps for creating a Tab report in Report Studio:
  1. Create a new report using Go Sales (Query) Package.
  2. Insert a table with 3 Columns and 2 Rows.
  3. Merge the cells in the second row.
  4. Create 3 text items (List, Crosstab and Chart) in the first row.
  5. Insert a Value Prompt before the table and change the name to Prompt.
  1. Create three static choice values for the value prompt.
  1. Change the following properties of value prompt.
·         Required – No
·         Hide Adornments – Yes
·         Auto Submit – Yes
  1. Place a HTML Item next to the value Prompt and copy the following code.
<script language="javascript">
function func(a)
{
var f = getFormWarpRequest();
var prompt = f._oLstChoicesPrompt;
if(a==1)
{
prompt.options.selectedIndex = 2;
}
else if(a==2)
{
prompt.options.selectedIndex = 3;
}
else if(a==3)
{
prompt.options.selectedIndex = 4;
}
promptAction('finish');
}
</script>

  1. Place HTML Items before and after the text Items.
·         Before the Text Items
ü  List
<div id="hi" onclick="func(1)">
ü  Crosstab
<div id="hi" onclick="func(2)">
ü  Chart
<div id="hi" onclick="func(3)">
·         After the Text Items
</div>
  1. Create a String variable with the following expression.
case (ParamDisplayValue('Parameter1'))
when 'List' then 'List'
when 'Crosstab' then 'Crosstab'
when 'Chart' then 'Chart'
end

  1. Create three values for the string variable (List, Crosstab and Chart).
  2. Goto Page 1 and insert a conditional block in the second row.
  3. Select the conditional block and change the block variable to String 1.
  4. Select the current block as List and insert a List in the conditional Block.
  5. Insert dataitems in the list.
  6. Select the current block as Crosstab and insert a Crosstab in the conditional Block.
  7. Insert dataitems in the Crosstab.
  8. Select the current block as Chart and insert a Chart in the conditional Block.
  9. Insert dataitems in the Chart.
  10. Change the background of the first row.
  11. In the condition explorer, select List and change the background color of List text item’s table cell.
  12. Similarly make the changes for other table cells.
  13. Select the value prompt and change the following properties.
·         Default Selections – List
·         Visible – No


Report Page





Report Output



Thursday, July 14, 2011

VBScript for downloading attachments from Outlook

VBScript for downloading attachments from Outlook and for saving in your local machine. Just save this file with .vbs extension and run it.

dim item1
dim objsubject
dim pa
dim savename
dim savefolder
savefolder = "D:/temp/"
Set olApp=CreateObject("Outlook.Application")
 Set olns=olApp.GetNameSpace("MAPI")
 Set objFolder=olns.GetDefaultFolder(6)
 msgbox objfolder
 For each item1 in objFolder.Items
if item1.Unread=true then
objsubject = item1.subject
if objsubject = "*****Give the mail subject here*****" then
pa =  item1.Attachments(1).filename
savename = savefolder & pa
msgbox savename
item1.Attachments(1).SaveAsFile savename
end if
end if
Next