Can someone please help me out understand what am I doing wrong?
I have the following structure of my CUBE:
And I`m creating the following calculated member in MDX in Visual Studio:
CREATE MEMBER CURRENTCUBE.[Measures].[Current_State]
AS EXISTS([DWH Dim Work Item Current].[State].[State].Members,[DWH Dim Work Item Current].[Title].Currentmember).Item(0).Name,
VISIBLE = 1;
But for some reason I get only the first value (i.e. "Active") for every row in Excel:
Can someone please tell me what I`m doing wrong and how I should fix it?
Thank you in advance!
Does EXISTING work any better?
CREATE MEMBER CURRENTCUBE.[Measures].[Current_State]
AS EXISTING([DWH Dim Work Item Current].[State].[State].MEMBERS).ITEM(0).NAME,
VISIBLE = 1;
Related
I am trying to update some code that I didn't originally write.
I'm getting an error right out of the gate with ProgressBar, but I can't seem to identify what the problem is.
My code is:
Public Function CharStyles() As Dictionary
Dim CharacterProgress As ProgressBar
Set CharacterProgress = New ProgressBar
' some more code after this...
End Function
Hovering over 'New ProgressBar' - I see the error "ProgressBar =Object variable or With variable not set", but I can seem to find any information on using ProgessBar in VBA to get any understanding of what that error means.
Can anyone help me understand what the issue is here? Presumably this code worked before, so I'm not sure what I'm missing that's causing it to break.
Thank you.
I'm working on creating a visual basic program that can find the sum total of a column from a database file and display it in a label control, and have been stuck for a while. I was hoping that someone could help me out a little.
I've tried a few different ways to accomplish it and they each keep throwing out the same error.
Dim SumQuery = From popualtion In PopulationDBDataSet.City
Aggregate order In PopulationDBDataSet.City
Into Sum(PopulationDBDataSet.City.PopulationColumn)
lblTotalPop.Text = SumQuery.ToString
and
Dim SumQuery = Aggregate Populaton In PopulationDBDataSet.City
Into Sumorders = Sum(PopulationDBDataSet.City.PopulationColumn)
lblAvgPop.Text = SumQuery.ToString
Both attempts produce the error "method sum not accessible in this context". Sorry for this post being a bit long but I'm out of ideas on this.
Your usage should include the variable used in Aggregate function:
Try this:
Dim SumQuery = From popualtion In PopulationDBDataSet.City
Aggregate order In PopulationDBDataSet.City
Into Sum(order.PopulationColumn)
I need to modify some VB.net code. There is a strange problem that I am facing. I am retrieving value from a DataTable and trying to assign it to a variable. When I check the value of some column in QuickWatch window then it has value but when I assign it to a variable then 0 is returned to the variable. Below is the simple statement that is causing the problem.
Dim MyAmount As Double = Double.Parse(dr.Item("Amount").ToString)
In the QuickWatch window when I check dr.Item("Amount") then it has value 30.12 and after executing the above statement MyAmount has value 0. May be VB.net work somewhat different that I do not know?
Edit:
It is kind of wierd that above mentioned statement is not returning value. The following statement is running absolutely fine.
Dim tmpVar As String() = dr.Item("Amount").ToString.Split(".")
Latest Edit:
I think it has become more wierd. The problem does not seem to be related with dr.Item("Amount"). Suppose I want to store the current culture value in a variable by following code,
Dim CultureInformation As String = System.Globalization.CultureInfo.CurrentCulture.DisplayName
Now CutlureInformation variable after the statement is executed contains "nothing" but the DisplayName has value of English (United States). So I think the problem is somewhere else.
You should be using this syntax:
Dim MyAmount As Double = dr.Field(Of Double)("Amount")
I am not sure why you are getting this behavior - your line should work too.
You can also try this:
Dim MyAmount As Double = DirectCast(dr.Item("Amount"), Double)
When facing a weird issue like this, always try various options to achieve the same result, do your research and compare the outputs. It greatly helps to answer a question on StackOverflow.
Hoping someone can help me out with what is probably a dumb question.
I'm trying to use a datarepeater to display data generated via LINQ from a datatable
I've managed to do this fine with a filtered existing datasource using:
Me.Tbl_52TableAdapter.Fill(Me.CBRDataSet.tbl_52)
Dim query =
From dlist In CBRDataSet.tbl_52.AsEnumerable
Where (dlist.Field(Of String)("TL") = "CTS 06")
Select dlist
query.CopyToDataTable().AsDataView()
DataRepeater1.DataSource = query
The problem being that I need to aggregate a field in the dataset into a count.
If I replace the query with:
Dim query =
From CountAgent In CBRDataSet.tbl_52.AsEnumerable
Group CountAgent By PBX = CountAgent.Field(Of String)("TL") Into Count()
Select Count
It then states that:
'CopyToDataTable' is not a member of 'System.Collections.Generic.IEnumerable(Of Integer)'
I've tried to get around it by changing the declaration to:
Dim query As IEnumerable(Of DataRow) =
Which compiles, but I have no idea if it works, and I cant check as I can't find a way to bind a label to the produced count col of the dataview.
If anyone can tell me what I'm doing wrong i'd be most appreciative.
Coming back to my own question, in case it helps anyone else: MSDN had the answer -
You need to overload copyToDataTable as described in
"How to: Implement CopyToDataTable Where the Generic Type T Is Not a DataRow"
on:
http://msdn.microsoft.com/en-us/library/bb669096.aspx
I've got a BindingSource for a DataSet. I'm fairly new to this whole binding business and databases, and it took me hours to figure out how to use BindingSource to get to an item, because the Row method was not included in the autocomplete. Not to confuse anyone, here's some sample code:
Dim somePreperty As String
Dim dataSet As New MyDataSet
Dim table As New MyDataSetTableAdapters.MyTableAdapter
Dim source As New BindingSource
source.DataSource = dataSet
source.DataMember = "SomeMember"
table.Fill(dataSet.SomeMember)
lablCabinet.DataBindings.Add("Text", source(0), "MemberID") '<This works fine>'
someProperty = source.Item(0).Row("ProductModel") '<So does this>'
The code runs perfectly and does exactly what I want. My problem is the following: When I've typed in source.Item(0)., autocomplete does not display Row in the list. Is this perhaps not the best way to do what I'm doing? Is there a reason it's hidden? Is this a good coding practice to do so? The fact that is wasn't there took me lots of time Googling, so I'm trying to figure out whether it's a Visual Studio glitch or my own.
Thanks in advance! = )
source.item(0) returns an object, so intellisense has no idea what is is.
You know what it should be, the compiler does not.
If you cast it first to a table or assing it to a table, intellisense will kick in.
So either:
ctype(source.item(0),datatable)
Or
dim tbl as datatable=source.item(0).