QlikView: How to set a selection for PDF reports? - pdf

Situation:
I have some sheets in my QVW and two alternate selection states:
1. Standard (for selection of an arbitrary date in the reports)
2. PreviousDayFix (for sheets that shall display the data of the previous day only)
For 1.) the user can select the filters and for 2.) the fields are set by document triggers (on open document) and the filters are not displayed for the user, so he cannot change them.
Problem:
I have a report based on one of the "previous day sheets". When I distribute this report as PDF via E-Mail, it seems, that the document triggers are not executed. So the "previous day" will not be set correctly. So when someone opens the Document on 20th Jan, the date is set to 19th Jan. If he doesn't open it on 21st Jan, then the PDF report will stick on the 19th Jan.
I've seen, that you can select one of the following options in the report settings:
Current selection
Clear selection
Bookmark
But there seems to be no option: "use whatever the document triggers set".
How can I fix / workaround this?

Ok - I did not found an option in qlikview, but a very clean workaround.
Add a field to your calender IsYesterday with if(Date = today()-1, 1, 0)
Don't set the Day, Month, Year fields with the document trigger, but set the IsYesterday field to 1
Make sure, you ran the script at least once
Then it doesn't matter, if the PDF report distribution executes the trigger or not, because the filter stays the same. And since the data is reloaded, the IsYesterday-filter automatically adjusts to the correct date.
Because my question is not only valid for Dates, this answer is not only valid for dates, too.
Basically the trick is, to use a field, where you programatically implement the filter condition and return a boolean. Then you select that boolean (manually or with a document trigger) and save the QVW. Next time, the PDF report generates, the filter is applied.

Related

Adding Previous and Next Month Functionality to Calendar Report

So what I'm trying to do is generate a calendar report in Report Builder based on the start and end dates entered. Based on this, I want to use buttons below the calendar called "Previous Month" and "Next Month" that on-click, will go to the previous or next months' calendar based on the start and end dates entered. I've tried doing this with a sub-report (report calls itself with new parameter values), but after one button click back or forwards, it starts decrementing or incrementing by year instead of month. Is there any way to do this? I'm trying to make this previous month/next month toggle work like that of Micorsoft Outlook's Month View.
Thanks in advance!
According to MSDN, you are using incorrect syntax in your expressions, which makes me wonder how it's even working at all.
Your DateAdd should use the DateInterval enum, and I'm not sure why you even need to use DateSerial, but it should have its hard-coded parameters in double-quotes.
Seems to me that this expression should work for what you need:
=dateadd(DateInterval.Month,-1,Parameters!start_cymd.Value)
But that's assuming, as per your comment, that the users can only choose a full month's data, so the start_cymd parameter will always be the first of the month.
Getting the end date is trickier because different months have different end-dates. Here's an example from the same MSDN page:
=DateSerial(Year(Parameters!start_cymd.Value), Month(Parameters!start_cymd.Value), "1").AddDays(-1)
These should get the start and end date of the previous month. Reverse the math/logic to get the next month.

Crystal Report using between but only 1 parameter is showing when Entering date values

I have a formula in crystal reports that uses a year period to select its date range.
I want to edit it to bring back a range rather than just a single period.
However it is not giving me the option when entering values to give two parameters.
Current Code:
{PDP_ACC_PERIODS__.ACC_PERIOD} in {?ACC_PERIOD} to {?ACC_PERIOD}
But there is only one box to enter this, not two (as in from and too).
Added an identical parameter called ACC_PERIOD2 that looks at the same field, then added it in the selection expert as.
ACC_PERIOD
is between {?ACC_PERIOD}
{?ACC_PERIOD2}

Job/Work scheduler/planner for teams

Currently we use an excel spreadsheet with 4 tabs (as tab for each team), each tab is a planner/diary that week, each day has 4 "slots" for jobs that are planned in.
The people type in the information for each job into one of the 4 slotsfor the day. Each slot contains information in different cells; Job No., Address, Duration, Notes, etc...
The issue/time consuming aspect of this method is when jobs have to be moved about between teams or moved to a different day it involves lots of copying, pasting and deleting.
What I am trying to achieve is some form of drag/drop interface (similar to the way the calendar in Outlook works), where the people who use the spreadsheet can input details for the job in a form and then have a drag an drop "tile" to be able to drag into one of the "slots.
The data contained in these slots needs to be able to produce a report which is a linear list of all the jobs planned that week.
I am at a loss to figure out what method I should use to create this, it seems it is beyond the reach of Excel from what I can find, also beyond the reach of Access, so I suspect it will involve some form of programming. I have basic understanding of VBA, but that's about it.
Can anyone make any suggestions.
Thanks
Working with data in this format will always be hard and I would not reccomend adding any drag and drop until you have sorted out the structure of your data.
You might like to consider another approach, which involves restructuring your data to make it easier to work with...
If you had one sheet with the following columns:
Teamname
Date (instead of Week Number and Day of week,)
Timeslot
JobNo
Address
Duration
Notes
Etc
Then each row would represent a job and have details of when it is occurring.
This is way a database would store the information about the jobs that are happening.
To change when a job is happening, all you have to do is update the date (and timeslot) of the row.
You could then create another worksheet for each team that uses excel formulas to lookup jobs happening this week and display them in a column for each day - like you have now. These sheets would be for display purposes only.
(You would use formulas like VLOOKUP etc)
If you want to change the date of a job you then simply go to the worksheet with the long list and change the date.
Having your data in this long list (ie normalised) format will give you many benefits. For instance you can summerise the report of the data using pivot tables.
If you add filters to the long list (SEE Ribbon>>Data>filters) you can order the data and reduce the list to only show jobs on a selected date, or for a selected team etc...
This is definitely the way forwards. Having restructured the data in this way, you could then add flashy ways to change when a job is taking place by adding buttons on the team worksheets or something.
PART2:
So in you ling list I would recommend excel CONCATENATE function to add an extra column with the text you want displayed elsewhere in your "calendar". #COLUMNA
I would also create another column which is a unique identifier for the row. This will probably be the "Date in YYYMMDD format & timeslot in HHMI format" concatenated together.
In the calendar view sheets say you need a column to display each day of the week with a row for each time slot: You need to
enter a StartDate of the period you want to view
Set up a column for each day (with a formula to calculate the date of the day (ie StartDate, StartDate+1 etc). The date is displayed as a column header (perhaps with a format that shows the dayname, but is stores the date)
each row will have a column that has the timeperiod name and each row will have a value entered. The value is the same as those used in the long list's timeperiod column.
When a user double clicks on a cell you can use the worksheet event
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
in the VBA code, for this event you need to:
see if the cell double clicked is one you want to respond to
if it is find the date and timeperiod from the corresponding column and row header.
use VBA to activate the long list sheet and probably filter to only show the jobs taking place that day or perhaps that week. Then select (or highlight?) the job that was double clicked.
This is quite easy once you know VBA.
There is a lot to know though I would:
use a named range to define the row with the date and another to define the column with the timeperiod
use a named range to define the cells that will respond to a double click
use range functions in VBA like intersection and the entirerow, entirecolumn range properties to find the date and timeperiod of the double clicked cell.
use the macro record to write the initial code that will do the filter.
adjust the code to be well written and to find the date and timeperiod as required.
Create a sheet for all departments? Or just create one sheet where the dept can be chosen.
You could get clever and allow the user to select two cells in the calendar and provide buttons that do things like:
swap the jobs
If they select many cells then a button to Goto the list and only show jobs that were selected in the calendar.
Perhaps the user could select one job and buttons could move the job back or forwards 1,2,7,14 days.
Note that you can use the long list to record other details of the job like time taken, customer, start time, end time etc...
See about Pivot tables here which might give you some ideas about how you can summarise you data to give info like jobs per day, total value of jobs by day, etc...
Before you tie yourself in knots using Excel, you should always consider using Access.... as with someone who know what they are doing, access will deliver a lot more in a shorter period of time and can do nice things like print one page per job etc etc...
(Do you need a contractor?)
mr#HarveyFrench.co.uk

Same date format over several localizations

Currently im facing issue that troubles me a lot. I hope that somebody could help me out. I work for big company where are both Office 2007 (32bit) and Office 2010 (64 bit) used. Writing macros to be compatibile through whole company was hard task for me (I've never programmed in VBA before - actually this forum helped me a lot). My task is to maintain one big table in shared Excel sheet. There are several macros and several userforms. Now i will decsribe the problem briefly:
Sheet contains two columns with date format (start date and close date). Both values are imported to column form userform's textboxes (commandbutton lunches MsCal -exported to class- which fills those textboxes with date). What I simply need is to have date format as mm/dd/yyyy in both columns in order to perform filtering and other operations. When this values are updated by worker that uses different localization than English U.S. date is entered as dd.mm.yyyy. Thats make proper filtering based on date impossible. I tried to alter formating by:
UserForm1.TextBox10.Value = Format(Calendar1.Value, "mm/dd/yyyy")
but this piece of code misbehave somehow. On some machines it works, on some of them it is not working. And thats what is giving me headache. How should i proceed now? Is there a way to force excel to use same date format in sheet and ignore localization settings in Windows? Employees dont want to change localization to English U.S. because they are either used to their format, or need it for other applications. Is there a way to temporarily change localization only when this sheet opens?
Any advice will be apreciated.
Thanks in Advance
Peter
The best you can do is NEVER transform a date variable into Text.
Internally for excel a date is just a consecutive number (Left from the decimal separator are days and right from the decimal separator are hours). So, for example, the 10th of June 2012, for excel is 41188. This date value is independent of the date format set on your computer.
Now when it comes to represent dates (for humans to visualize) Excel will format this internal value into a String with the format set in your computer. So, for example if you have US date format in your computer, the date 41188 will be formated as 6/10/2012.
The big challenge with dates is to input the date in the correct format. When you input a Date as a string ("6/10/2012") then Excel will interpret it depending on the date format set on your computer. If you have US format, then it will thake the first cypher as month, the second as day and the last as the year. If you have a German format, it will read the first as day, the next as month and the last as year. So, the same input ("6/10/2012") for a US Format Excel will read 10th of june as for a German format Excel will read 6th of Oktober.
In your case, you should NOT format the date inside the Textbox10. For a US format Excel there is no problem, but if you have another date format, where the first cypher is the day instead of the month, you will get the wrong values:
Check this example. User inputs 10th of June in a German format Excel (dd.mm.yyyy)
Calendar1.Value retrieves a date value (41188)
Format(Calendar1.Value, "mm/dd/yyyy") transforms the date value into a string "06/10/2012"
When using the formated date (STRING), Excel will have to interpret what date it is. Because the computer date format is German, it will read Day:06, Month:10, Year:2012. You will be using day 41070 instead of 41188
If Calendar1.Value retrieves a Date variable and you give this date variable into a Date formated column, you will allways get the correct dale in your column and you will be able to filter and sort dates correctly regardless of the date format set inside the Column cells or the format set in the users computer.
Now, in your case, the best would be to assign directly the Calendar1.Value to the required cell. Something like:
ThisworkBook.WorkSheets("Sheet1").Range("C3").Value= Calendar1.Value
You can still asign Calendar1.Value into the TextBox10 for the user to see his selection, but disable the TextBox10 so that the only edit option is the calendar control. And when working with the date, istead of thaking it from the TextBox10, taking it directly from the Calendar1.Value .
If you still need to show the selected value from Calendar1 into a textBox then do NOT format the date in the Textbox. Instead, use:
UserForm1.TextBox10.Value = Cstr(Calendar1.Value)
This way, the user will see the date in the dateformat that he has set in his computer and to which he is used to.
One solution is to not use the date number format but rather only use the custom format for all your cell dates where you specify "mm/dd/yyyy" as the formatting string. However, in my experience, if your computer's regional settings are set to use "mm/dd/yyyy" then if you try make a custom cell formatting with this same string excel will keep as a dater linked to the computer setting so that doesn't help you. The way I worked around this was to change the date format on my computer, then format the cells as custom "mm/dd/yyyy" and save (and then turn your computer's settings back to how they were.) Now even though excel still claims they are date cells, you'll see that changing the settings on your computer doesn't change the value in the cell.
I guess another way is to always have a cell next to your date cell that calls the TEXT function. So if you have a date in A1 then in another cell =TEXT(A1, "mm/dd/yyyy") and only refer to this new cell. But that could make your spread sheet very messy.
I guess the best solution is to just get you IT dept to set every one in the company's date settings to use the same formats.

Adding Custom Autotext for MS Word

I need to know how to add a custom, dynamic Autotext entry for Microsoft Word. I want to be able to Insert>Autotext>Header/Footer>"Last Friday" and have last Friday's date show up in the spot and keep it updated like inserting the Date Autotext updates each time the document is opened.
I have the VB code necessary to compute last Friday's date and return it as a String, but I am having trouble finding how to tie the function's output to a new Autotext entry.
It would also be acceptable to add a custom entry into the Insert>Field list as well.
There is another thread here
http://www.tech-archive.net/Archive/Word/microsoft.public.word.vba.beginners/2007-02/msg00050.html
This might have a solution for you.