Selected Dimension Value in Expression in QlikView - qlikview

Just wondering how to get a selected value in an expression. I have the following bar chart, with drill down from Year to months.
When I click say 2011 bar I get the following chart.
Now is there a way to get Transported Mail - 2011 in the second chart instead of just plain Transported Mail. Note that 2011 is the current selected year. I want it to be incorporated in the label expression. Please guide.

You can use set analysis for this...
Try this:
= 'Transported Mail -' & concat({state_name} DISTINCT year_var,',')
Note If you haven't created any alternate states, you can use $ as your state_name
Now, you can get much more complicated with this to allow it to handle multiple years differently, but this should do the trick for you.

Related

SSRS - Expression not working after putting Subreport

I have trouble regarding expression.
I have a report that has a calendar style. (Screenshot below)
I have an expression on the Day Number on the top left of the calendar cell, and it works (Which is in the top box).
Here is the expression :
=IIf(IsNothing(Fields!DayNumberOfMonth.Value), " ", Fields!DayNumberOfMonth.Value)
But when I added my sub-report which returns the list of employees and their schedule per date, the Expression is not working anymore. Some random number appears on the top left of the box, which is supposed to be blank. (Screenshot below)
Here is the Design View :
Any solutions or suggestions? Thank you in advance, I will appreciate it very much.
Is it possible that your week number from your subreport is not correctly aligning with the main report. It looks like it is using the number 7 from the next Sunday.
I figured it out. I set the visibility to "Show or hide based on an expression, then set the expression to : =IIf(IsNothing(Fields!empName.Value), True, False)

dynamic row print area excel VBA

I want to give the user the option to press "set print area" and the area printed is determined by which date they fill in.
The 2nd row always contains today's date. and then there is 2 years of data after that. Maybe the user only wants to print for first 3 months.
So the set print area code should be written something like.
row = len(date max - len today)
I am very new to VBA, so have no clue how to write this.
thank you!
I'm not sure why you want to use VBA to do this when you can just use 'Filter' on the data you have. On the date column you can then use the in-built 'Date Filters' to filter out any range of data. Once you specify the filter, print command will only print the filtered data set and not the complete data set.
Anyways if you want the row it can also be achieved via Excel Formula:
=ADDRESS([dataset_first_row]+MATCH([set_print_area_date_cell],[dataset_date_range],-1)-1,2,4,1)

Flexible Data Label Formatting

I'm hoping to add custom data labels to a stacked bar chart in Excel 2010. Each bar will have a label value pulled from a value in the sheet which is not necessarily equal to the height of the bar itself.
The sheet I'm making is a template and has drop-down selections to change the units of the data. For example: $MM with 1 decimal point, K with 2 decimal points, $ with 0 decimal points, etc... I'm running into an issue formatting the labels to match the data formatting selections. I've tried two approaches:
Formatting the data labels themselves using VBA. Partial code below for $K with one decimal:
`With ActiveChart.SeriesCollection(x).Points(y)`
.DataLabel.Text.NumberFormat = "$#,##0.0,"
Unfortunately, the labels don't seem to read the commas and divide by one thousand, so I can't accurate display thousands or millions. A value of 1000 in the above code will display as $1,000.0 instead of the desired $1.0.
Format the values in the worksheet, and then just read them with VBA. Basically, I use conditional formatting to properly display the values on the sheet, and then read them with .DataLabel.Text = Cells(r,c)
Unfortunately, though the data is formatted correctly, the values are unchanged and the labels display with no custom formatting at all.
Is there any reasonable way to achieve my goal? I'm hoping there's a way to either (1) make commas count when changing data label number formats or (2) change the actual values of the data in my sheet based on the formatting drop-down selections (instead of just giving them custom formatting which leaves the value unchanged).
Thank you,
Lance
I think the words "conditional formatting" are your issue here: I've had problems with VBA reading the underlying format of a cell when it's conditionally formatted (admittedly, my issue was with colour, rather than number format, but I expect the reasons for it not working would be the same).
If you adopt your second approach, i.e. relying on the worksheet's format using the chart's "Linked to source" option, then on a trigger of when the drop-down option is changed, you could use VBA to set the format on the worksheet instead of using conditional formatting - then the chart would pick up whatever format you're using.
Please try this:
?Format(1000,"$#,##0.0,")
$1.000,0
?Format(1000,"$#,##0,.0")
$1,0
?Format(1234,"$#,##0,.0")
$1,2

VB.net Loop adding to combobox

Spent about an hour now, with multiple rages at my monitor. I have a variable which stores the amount of elements within an array.
I want to add the numbers '1' up to this variable number to a combobox. So that when i use the combobox, it gives the options of 1,2,3 etc up to the variable number. If anyone could help, that would a fantastic!!
Also, I tried a few different loops but caused visual studio to give an unable to access debug error when i tried to run the program. I am new to this so apologies if this seems basic.
The code I have below stores the count.
accno = custdetails.Count
You don't need to write the loop. This is a one-liner:
MyCombobox.Items.AddRange(Enumerable.Range(1, accno).ToArray())
I prefer that because it starts you thinking in terms of matching your presentation to a data source, which will help you a lot as you learn further.
But if you really want to:
For i As Integer = 1 to accno
MyCombobox.Items.Add(i)
Next

VBA Excel 2003/2007: Declaring, Filling, and Passing a Jagged Array

I have thoroughly researched this topic and have yet to find code that works to accomplish what I need to do. In a nutshell, I'm creating a Production Tracking program and the feature of it on which I'm working now involves accurately tracking vacation days for 5 employees. A userform containing 5 listboxes, one for each employee, is used to select which days each employee took off for the week. The problem comes when I try to create unique dynamic arrays containing each employees' days off. I figured out how to create an array that captures this information but it's one array that gets reassigned each time the loop iterates. I need to have a unique array for each employee containing his days off to be used later in the code to adjust weekly scoring depending on his available days of work. Below is my code in the userform for to create a create the jagged array:
Public Name_Jagged() As Variant
For Each Name In Name_Array
Set Unique_Listbox = Controls(Name & "_Vacation")
For UnSelected = 0 To Unique_Listbox.ListCount - 1
If Unique_Listbox.Selected(UnSelected) = False Then
ReDim Preserve Name_Jagged(0 To UBound(Name_Jagged) + 1)
Name_Array(Name) = Name_Jagged()
Name_Jagged(UBound(Name_Jagged)) = Unique_Listbox.List(UnSelected)
End If
For UnSelected_Array_Pos = LBound(Name_Jagged) To UBound(Name_Jagged)
MsgBox Name & "_" & Name_Jagged(UnSelected_Array_Pos)
Next UnSelected_Array_Pos
Next UnSelected
Next Name
The compiler will not allow me to use Public Name_Jagged()() As Variant either despite most other forums saying this is how it's supposed to be written. The only other post I found online regarding this jagged array declaration issue was not answered.
I would really appreciate your help. I've been able to figure out everything so far from previous threads but this has eluded me. If there is a better option than jagged arrays to accomplish this, I'm all ears. I read in some forums about using Lists but I am not at all familiar with them or how to use them at this point. Thanks in advance for the help.
Just a thought but why have 5 static listboxes for each employee?
Why not just have 1 list box which contains the names of the employees and 1 list box which contains the days of the week. You highlight the employee you want and than select the days which they've taken off. Hit a submit button which would load the employees name into an array with the days selected? The array could be structured like this
NAME | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY
JIM..... OFF............ OFF
ERIC.......................OFF.............OFF
And so on. This way if you need to add people in the future you just add them to the list box. You would than have one simple array to deal with?
Also you said "to be used later in the code to adjust weekly scoring depending on his available days of work"
A suggestion; You may want to consider logging it to a simple mysql/mssql database which gives you far more flexibility and control for the future.