Add columns to Power Query from Google Analytics - google-analytics

I'm using Kohera's Power Pivot Formula to get Google Analytics data in Power Query:
let
analytics = "https://www.googleapis.com/analytics/v3/data/ga?access_token=",
addAccessToken = analytics &
Excel.CurrentWorkbook(){[Name="TblToken"]}[Content]{0}[Access Token],
addViewId = addAccessToken & "&ids=ga:33784873",
addStartDate = addViewId & "&start-date=2014-10-01",
addEndDate = addStartDate & "&end-date=2014-12-31",
addDimensions = addEndDate & "&dimensions=ga:operatingSystem",
url = addDimensions & "&metrics=ga:sessions",
GaJson = Json.Document(Web.Contents(url)),
GetRows = GaJson[rows],
TableFromList = Table.FromList(GetRows, Splitter.SplitByNothing(),
null, null, ExtraValues.Error),
ColOS = Table.AddColumn(TableFromList, "OS", each [Column1]{0}),
ColCount = Table.AddColumn(ColOS, "Count", each [Column1]{1}),
RemoveFirstColumn = Table.RemoveColumns(ColCount,{"Column1"}) in RemoveFirstColumn
However, how do I add more columns? For example, if I wanted to do a query for ga:hostname,ga:country,ga:browser, how would I get this in M code?
Thank you!

OK, I've figured it out. To explain for others:
TableFromList = Table.FromList(GetRows, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ColHostname = Table.AddColumn(TableFromList, "Hostname", each [Column1]{0}),
ColCountry = Table.AddColumn(ColHostname, "Country", each [Column1]{1}),
ColBrowser = Table.AddColumn(ColCountry, "Browser", each [Column1]{2}),
ColCount = Table.AddColumn(ColBrowser, "Count", each [Column1]{3}),
RemoveFirstColumn = Table.RemoveColumns(ColCount,{"Column1"})

Related

Create a inventory movement journal in Dynamics AX 2012

This problem is driving me nuts... I don't know how to fix it. I'm trying to create an inventory movement journal entry using the ProfitLossJournalService.
The code below runs, but it shows the transaction in the "inventory adjustment" journal. I want it in the inventory movement jounal.
public void UpdateInventoryForConsumableItem(InventoryUpdate update)
{
var svc = new ProfitLossJournalServiceClient();
var cc = new CallContext {Company = "SS"};
var journal = new AxdProfitLossJournal();
var table = new AxdEntity_InventJournalTable
{
InventDimFixedSpecified = false,
InventSiteId = "MC",
InventLocationId = "MAIN WH",
JournalType = AxdEnum_InventJournalType.Movement,
JournalNameId = "InvMovJour",
Description = Constants.InventoryMovementJournalDescription,
NumOfLines = 1,
NumOfLinesSpecified = true,
JournalTypeSpecified = true,
JournalId = "InvMovJour",
JournalIdOrignal = "InvMovJour",
action = AxdEnum_AxdEntityAction.update
};
var inventoryDims = new AxdEntity_InventDim
{
InventLocationId = "MAIN WH",
InventDimId = update.InventoryDimId,
InventColorId = update.Color,
InventSiteId = "MC",
InventSizeId = update.Size,
InventStyleId = update.Style,
action = AxdEnum_AxdEntityAction.create
};
var entry = new AxdEntity_InventJournalTrans
{
InventDimId = update.InventoryDimId,
TransDate = DateTime.Now,
ItemId = update.ItemId,
CostMarkupSpecified = false,
InventRefTypeSpecified = false,
LineNumSpecified = false,
JournalType = AxdEnum_InventJournalType.Movement,
JournalTypeSpecified = true,
Qty = update.Quantity,
QtySpecified = true,
InventDim = new AxdEntity_InventDim[1] {inventoryDims}
};
table.InventJournalTrans = new[] {entry};
journal.InventJournalTable = new[] {table};
try
{
var result = svc.create(cc, journal);
Logger.LogTrace(string.Format("sending InventoryTransferJournal {0}", result.GetValue(0)));
Logger.LogEvent(Logger.SentConsumableInventoryUpdateToDynamics);
}
catch (Exception e)
{
Logger.LogException(e);
throw;
}
}
When you use the ProfitLossJournalService that is essentially what you are creating, an Inventory adjustment.
If you want to create an inventory movement journal, unfortunately there is no standard AIF service that does that. You would need to implement that yourself and expose it to AIF.

Putting labels inside of a vb.net Array

So i've created 5 different arrays for labels These are
Dim ovsoLabels As Label(), customerLabels() As Label, itemNameLabels() As Label, quantityLabels() As Label, topRightItemNameLbls(5) As Label
Dim indexLabels() As Label
After that I have a function that assigns those variables to actual labels.
'assign labels to array
ovsoLabels(0) = oVSO10
ovsoLabels(1) = oVSO11
ovsoLabels(2) = oVSO12
ovsoLabels(3) = oVSO13
ovsoLabels(4) = oVSO14
customerLabels(0) = custLbl20
customerLabels(1) = custLbl21
customerLabels(2) = custLbl22
customerLabels(3) = custLbl23
customerLabels(4) = custLbl24
itemNameLabels(0) = nameLbl1
itemNameLabels(1) = nameLbl2
itemNameLabels(2) = nameLbl3
itemNameLabels(3) = nameLbl4
itemNameLabels(4) = nameLbl5
quantityLabels(0) = quantLbl1
quantityLabels(1) = quantLbl2
quantityLabels(2) = quantLbl3
quantityLabels(3) = quantLbl4
quantityLabels(4) = quantLbl6
indexLabels(0) = indexLbl10
indexLabels(1) = indexLbl11
indexLabels(2) = indexLbl12
indexLabels(3) = indexLbl13
indexLabels(4) = indexLbl14
After that I call the function in my timer tick
and this is what i'm triying to do (Not quoteArray has numbers in it 0 - infinity)
For i = 0 To 4
If quantityArray(i) = Nothing Then
ElseIf quantityArray(i) = 0 Then
quantityLabels(i).ForeColor = Drawing.Color.Green
customerLabels(i).ForeColor = Drawing.Color.Green
itemNameLabels(i).ForeColor = Drawing.Color.Green
ovsoLabels(i).ForeColor = Drawing.Color.Green
indexLabels(i).ForeColor = Drawing.Color.Green
Else
quantityLabels(i).ForeColor = Drawing.Color.Black
customerLabels(i).ForeColor = Drawing.Color.Black
itemNameLabels(i).ForeColor = Drawing.Color.Black
ovsoLabels(i).ForeColor = Drawing.Color.Black
indexLabels(i).ForeColor = Drawing.Color.Black
End If
Next
This is my first post, so tell me if I can format better. The error I'm getting is that it tells me that there is no object and I need to use the keyword new. Not sure what that means, thanks!

full page not accessible

I have scraped following page my problem is that I want to redirect my code to desired page . I get the page but its not fully loaded contain many missing information why is that?
here is the code
include("admin/LIB_http.php");
include("admin/LIB_parse.php");
include("admin/LIB_resolve_addresses.php");
include("admin/LIB_http_codes.php");
include("admin/database.php");
$action = "http://domestic-air-tickets.expedia.co.in/flights/initiate-booking";
$method="GET"; // GET method
$ref = "http://domestic-air-tickets.expedia.co.in/flights/results?from=DEL&to=HYD&depart_date=25/08/2012&adults=2&childs=0&infants=0&dep_time=0&class=Economy&airline=&carrier=&x=57&y=16&flexi_search=no ";
// Referer variable
$data_array['rnd_one'] = "O";
$data_array['from'] = "DEL";
$data_array['to'] = "HYD";
$data_array['depart_date'] = "25/08/2012";
$data_array['adults'] = "2";
$data_array['childs'] = "0";
$data_array['dep_time'] = "0";
$data_array['class'] = "Economy";
$data_array['airline'] ="";
$data_array['carrier'] = "";
$data_array['timestamp'] = "1345783916448";
$data_array['companyid'] = "110342";
$data_array['source'] = "WL";
$data_array['BIZ_ACTION_MODE'] = "VIEW_ORDER_CAPTURE";
$data_array['topLevelRateRules'] = '{"cc":{"df":{"pg":{"f":250.0}}},"dc":{"df":{"pg":{"f":250.0}}},"nb":{"df":{"pg":{"f":250.0}}},"kc":{"df":{"pg":{"f":250.0}}},"ca":{"df":{"pg":{"f":250.0}}},"tax":{"CC":0.0, "DC":0.0, "NB":0.0, "KC":0.0, "CA":0.0}}';
$data_array['emiJson'] = "{}";
$data_array['out_no_legs'] = "1";
$data_array['out_base_price'] = "8860";
$data_array['out_adult_base'] = "8860";
$data_array['out_taxes'] = "7678";
$data_array['out_disc'] = "0";
$data_array['out_price'] = "16538";
$data_array['out_fare_key'] = "supp_INDIGO|si-90efea02-d16b-4cec-808a-3d79792ea2b2|fk_6E_311_1345859400000_E0DELHYD_true_";
$data_array['out_leg_aircode_1'] = "6E";
$data_array['out_leg_from_1'] = "DEL";
$data_array['out_leg_fromCityName_1'] = "New Delhi";
$data_array['out_leg_fromAirportName_1'] = "Indira Gandhi Airport";
$data_array['out_leg_to_1'] = "HYD";
$data_array['out_leg_toCityName_1'] = "Hyderabad";
$data_array['out_leg_toAirportName_1'] = "Rajiv Gandhi International";
$data_array['out_leg_via_1'] = "n";
$data_array['out_leg_departs_date_1'] = "25/08/2012";
$data_array['out_leg_flt_num_1'] = "311";
$data_array['out_leg_arrives_date_1'] = "25/08/2012";
$data_array['out_leg_fare_basis_1'] = "E0DELHYD";
$data_array['out_leg_fare_class_1'] = "supp_INDIGO|si-90efea02-d16b-4cec-808a-3d79792ea2b2|";
$data_array['out_leg_cabin_type_1'] = "E";
$data_array['out_leg_refundable_1'] = "R";
$data_array['out_leg_oa_1'] = "";
$data_array['out_leg_arrives_1'] = "09:20";
$data_array['out_leg_departs_1'] = "07:20";
$data_array['out_leg_stops_1'] = "0";
$data_array['out_leg_departure_terminal_1'] = "Terminal 1D";
$data_array['ts'] = "10135741";
$data_array['fromCityName'] = "New Delhi";
$data_array['toCityName'] = "Hyderabad";
$response = http($target=$action, $ref, $method, $data_array, EXCL_HEAD);
print_r($response);
I can't upload images other wise u can see how page is different from original site page
I Solved it by var_dump the $response and then explode to get required URL

Dynamic Linq Select from String Value

Question Edit because simple table doesnt make things simpler..
The issue is i have to pick dynamic column value..
the column name came from prev page (DropDownList) => Current Page (HiddenField)
This is my Current Codes:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Data;
public partial class ViewChart : System.Web.UI.Page
{
BlupDataContext database = new BlupDataContext();
protected void Page_Load(object sender, EventArgs e)
{
HiddenFieldWCellName.Value = Request.QueryString["WCEL_Name"];
HiddenFieldSeries1.Value = Request.QueryString["Series1"];
HiddenFieldSeries2.Value = Request.QueryString["Series2"];
var q = from x in database.RSRAN079s
join y in database.RSRAN084s
on x.WCEL_Name equals y.WCEL_Name
where x.WCEL_Name == HiddenFieldWCellName.Value
select new
{
RSRAN079_ID = x.RSRAN079_ID,
PeriodStartTime = x.PeriodStartTime,
PLMN_Name = x.PLMN_Name,
RNC_Name = x.RNC_Name,
WBTS_Name = x.WBTS_Name,
WBTS_ID = x.WBTS_ID,
WCEL_Name = x.WCEL_Name,
WCEL_ID = x.WCEL_ID,
RRC_Conn_Access_Completitions = x.RRC_Conn_Access_Completitions,
RRC_Active_Drops_IU_FR = x.RRC_Active_Drops_IU_FR,
RRC_Active_Drops_IU_Fails = x.RRC_Active_Drops_IU_Fails,
RRC_Active_Drops_Radio_FR = x.RRC_Active_Drops_Radio_FR,
RRC_Active_Drops_Radio_Fails = x.RRC_Active_Drops_Radio_Fails,
RRC_Active_Drops_BTS_FR = x.RRC_Active_Drops_BTS_FR,
RRC_Active_Drops_BTS_Fails = x.RRC_Active_Drops_BTS_Fails,
RRC_Active_Drops_IUR_FR = x.RRC_Active_Drops_IUR_FR,
RRC_Active_Drops_IUR_Fails = x.RRC_Active_Drops_IUR_Fails,
RRC_Active_Drops_CIPH_FR = x.RRC_Active_Drops_CIPH_FR,
RRC_Active_Drops_CIPH_Fails = x.RRC_Active_Drops_CIPH_Fails,
RRC_Active_Drops_RNC_FR = x.RRC_Active_Drops_RNC_FR,
RRC_Active_Drops_RNC_Fails = x.RRC_Active_Drops_RNC_Fails,
RRC_Active_Drops_UE_FR = x.RRC_Active_Drops_UE_FR,
RRC_Active_Drops_UE_Fails = x.RRC_Active_Drops_UE_Fails,
RAB_Retainability_CS_Voice_SR = x.RAB_Retainability_CS_Voice_SR,
RAB_Retainability_CS_Conv_SR = x.RAB_Retainability_CS_Conv_SR,
RAB_Retainability_PS_SR = x.RAB_Retainability_PS_SR,
AMR_RAB_Setup_Access_Completitions = x.AMR_RAB_Setup_Access_Completitions,
AMR_RAB_Drop_Active_Drops_IF_FR = x.AMR_RAB_Drop_Active_Drops_IF_FR,
AMR_RAB_Drop_Active_Drops_IU_Fails = x.AMR_RAB_Drop_Active_Drops_IU_Fails,
AMR_RAB_Drop_Active_Drops_Radio_FR = x.AMR_RAB_Drop_Active_Drops_Radio_FR,
AMR_RAB_Drop_Active_Drops_Radio_Fails = x.AMR_RAB_Drop_Active_Drops_Radio_Fails,
AMR_RAB_Drop_Active_Drops_BTS_FR = x.AMR_RAB_Drop_Active_Drops_BTS_FR,
AMR_RAB_Drop_Active_Drops_BTS_Fails = x.AMR_RAB_Drop_Active_Drops_BTS_Fails,
AMR_RAB_Drop_Active_Drops_IUR_FR = x.AMR_RAB_Drop_Active_Drops_IUR_FR,
AMR_RAB_Drop_Active_Drops_IUR_Fails = x.AMR_RAB_Drop_Active_Drops_IUR_Fails,
AMR_RAB_Drop_Active_Drops_RNC_FR = x.AMR_RAB_Drop_Active_Drops_RNC_FR,
AMR_RAB_Drop_Active_Drops_RNC_Fails = x.AMR_RAB_Drop_Active_Drops_RNC_Fails,
AMR_RAB_Drop_Active_Drops_UE_FR = x.AMR_RAB_Drop_Active_Drops_UE_FR,
AMR_RAB_Drop_Active_Drops_UE_Fails = x.AMR_RAB_Drop_Active_Drops_UE_Fails,
CS_Conv_RAB_Setup_Access_Completitions = x.CS_Conv_RAB_Setup_Access_Completitions,
CS_Conv_RAB_Retainability_Completitions = x.CS_Conv_RAB_Retainability_Completitions,
CS_Conv_RAB_Active_Drops_IU_FR = x.CS_Conv_RAB_Active_Drops_IU_FR,
CS_Conv_RAB_Active_Drops__IU_Fails = x.CS_Conv_RAB_Active_Drops__IU_Fails,
CS_Conv_RAB_Active_Drops_Radio_FR = x.CS_Conv_RAB_Active_Drops_Radio_FR,
CS_Conv_RAB_Active_Drops_Radio_Fails = x.CS_Conv_RAB_Active_Drops_Radio_Fails,
CS_Conv_RAB_Active_Drops_BTS_FR = x.CS_Conv_RAB_Active_Drops_BTS_FR,
CS_Conv_RAB_Active_Drops_BTS_Fails = x.CS_Conv_RAB_Active_Drops_BTS_Fails,
CS_Conv_RAB_Active_Drops_IUR_FR = x.CS_Conv_RAB_Active_Drops_IUR_FR,
CS_Conv_RAB_Active_Drops_IUR_Fails = x.CS_Conv_RAB_Active_Drops_IUR_Fails,
CS_Conv_RAB_Active_Drops_RNC_FR = x.CS_Conv_RAB_Active_Drops_RNC_FR,
CS_Conv_RAB_Active_Drops_RNC_Fails = x.CS_Conv_RAB_Active_Drops_RNC_Fails,
CS_Conv_RAB_Active_Drops_UE_FR = x.CS_Conv_RAB_Active_Drops_UE_FR,
CS_Conv_RAB_Active_Drops_UE_Fails = x.CS_Conv_RAB_Active_Drops_UE_Fails,
Packet_Service_RAB_Setup_Access_Completitions = x.Packet_Service_RAB_Setup_Access_Completitions,
Packet_Service_RAB_Retainability_Completitions = x.Packet_Service_RAB_Retainability_Completitions,
Packet_Service_RAB_Active_Drops_IU_FR = x.Packet_Service_RAB_Active_Drops_IU_FR,
Packet_Service_RAB_Active_Drops_Fails = x.Packet_Service_RAB_Active_Drops_Fails,
Packet_Service_RAB_Active_Drops_Radio_FR = x.Packet_Service_RAB_Active_Drops_Radio_FR,
Packet_Service_RAB_Active_Drops_Radio_Fails = x.Packet_Service_RAB_Active_Drops_Radio_Fails,
Packet_Service_RAB_Active_Drops_BTS_FR = x.Packet_Service_RAB_Active_Drops_BTS_FR,
Packet_Service_RAB_Active_Drops_BTS_Fails = x.Packet_Service_RAB_Active_Drops_BTS_Fails,
Packet_Service_RAB_Active_Drops_IUR_FR = x.Packet_Service_RAB_Active_Drops_IUR_FR,
Packet_Service_RAB_Active_Drops_IUR_Fails = x.Packet_Service_RAB_Active_Drops_IUR_Fails,
Packet_Service_RAB_Active_Drops_RNC_FR = x.Packet_Service_RAB_Active_Drops_RNC_FR,
Packet_Service_RAB_Active_Drops_RNC_Fails = x.Packet_Service_RAB_Active_Drops_RNC_Fails,
Packet_Service_RAB_Active_Drops_UE_FR = x.Packet_Service_RAB_Active_Drops_UE_FR,
Packet_Service_RAB_Active_Drops_UE_Fails = x.Packet_Service_RAB_Active_Drops_UE_Fails,
Packet_Session_Rel_HSDSCH_EDCH = x.Packet_Session_Rel_HSDSCH_EDCH,
Packet_Session_Rel_HSDSCH_DCH = x.Packet_Session_Rel_HSDSCH_DCH,
Packet_Session_Rel_Alloc_Rel = x.Packet_Session_Rel_Alloc_Rel,
Packet_Session_Success_Ratio_SR = x.Packet_Session_Success_Ratio_SR,
Packet_Session_Drops_HSDSCH_EDCH_DR = x.Packet_Session_Drops_HSDSCH_EDCH_DR,
Packet_Session_Drops_HSDSCH_EDCH_Drops = x.Packet_Session_Drops_HSDSCH_EDCH_Drops,
Packet_Session_Drops_HSDSCH_DCH_DR = x.Packet_Session_Drops_HSDSCH_DCH_DR,
Packet_Session_Drops_HSDSCH_DCH_Drops = x.Packet_Session_Drops_HSDSCH_DCH_Drops,
Packet_Session_Drops_DCH_DR = x.Packet_Session_Drops_DCH_DR,
Packet_Session_Drops_DCH_Drops = x.Packet_Session_Drops_DCH_Drops,
Packet_Session_Drops_HSDSCH_EDCH_Other_DR = x.Packet_Session_Drops_HSDSCH_EDCH_Other_DR,
Packet_Session_Drops_HSDSCH_EDCH_Other_Drops = x.Packet_Session_Drops_HSDSCH_EDCH_Other_Drops,
Packet_Session_Drops_HSDSCH_DCH_Other_DR = x.Packet_Session_Drops_HSDSCH_DCH_Other_DR,
Packet_Session_Drops_HSDSCH_DCH_Other_Drops = x.Packet_Session_Drops_HSDSCH_DCH_Other_Drops,
Packet_Session_Drops_DCH_Other_DR = x.Packet_Session_Drops_DCH_Other_DR,
Packet_Session_Drops_DCH_Other_Drops = x.Packet_Session_Drops_DCH_Other_Drops,
HSDSCH_Alloc_Rel = x.HSDSCH_Alloc_Rel,
HSDPA_Retain_NW = x.HSDPA_Retain_NW,
HSDPA_Retain_RL_FR = x.HSDPA_Retain_RL_FR,
HSDPA_Retain_Non_RL_FR = x.HSDPA_Retain_Non_RL_FR,
HSDPA_Retain_Mobility_FR = x.HSDPA_Retain_Mobility_FR,
HSDPA_Retain_PRE_EMPTION_FR = x.HSDPA_Retain_PRE_EMPTION_FR,
HSDPA_Retain_Other_Mob_FR = x.HSDPA_Retain_Other_Mob_FR,
EDCH_Alloc_Rel = x.EDCH_Alloc_Rel,
HSUPA_Retain_NW = x.HSUPA_Retain_NW,
HSUPA_Retain_RL_FR = x.HSUPA_Retain_RL_FR,
HSUPA_Retain_EDCH_Rel_HSDSCH_SCC = x.HSUPA_Retain_EDCH_Rel_HSDSCH_SCC,
HSUPA_Retain_Other_FR = x.HSUPA_Retain_Other_FR,
HSDSCH_SCC_UE_FR = x.HSDSCH_SCC_UE_FR,
HSDSCH_SCC_UE_Fails = x.HSDSCH_SCC_UE_Fails,
HSDSCH_SCC_BTS_FR = x.HSDSCH_SCC_BTS_FR,
HSDSCH_SCC_BTS_Fails = x.HSDSCH_SCC_BTS_Fails,
HSDSCH_SCC_Trans_FR = x.HSDSCH_SCC_Trans_FR,
HSDSCH_SCC_Trans_Fails = x.HSDSCH_SCC_Trans_Fails,
HSDSCH_SCC_AC_FR = x.HSDSCH_SCC_AC_FR,
HSDSCH_SCC_AC_Fails = x.HSDSCH_SCC_AC_Fails,
HSDSCH_SCC_Other_FR = x.HSDSCH_SCC_Other_FR,
HSDSCH_SCC_Other_Fails = x.HSDSCH_SCC_Other_Fails,
R99_Alloc_Rel = x.R99_Alloc_Rel,
R99_Retain_NW = x.R99_Retain_NW,
Inter_RNC_SCC_Fail = x.Inter_RNC_SCC_Fail,
Inter_RNC_SCC_Drop = x.Inter_RNC_SCC_Drop,
RSRAN084_ID = y.RSRAN084_ID,
PeriodStartTime2 = y.PeriodStartTime,
RNC_Name2 = y.RNC_Name,
WBTS_Name2 = y.WBTS_Name,
WBTS_ID2 = y.WBTS_ID,
WCEL_Name2 = y.WCEL_Name,
WCEL_ID2 = y.WCEL_ID,
Cell_Availability = y.Cell_Availability,
Cell_Availability_Exclude = y.Cell_Availability_Exclude,
RRC_Set_Att = y.RRC_Set_Att,
RRC_Set_Acc_CR_NW = y.RRC_Set_Acc_CR_NW,
RRC_Set_Acc_CR_UE = y.RRC_Set_Acc_CR_UE,
RRC_Conn_Setup_SR = y.RRC_Conn_Setup_SR,
RRC_Conn_SR = y.RRC_Conn_SR,
RRC_Reg_Att = y.RRC_Reg_Att,
Regist_SR = y.Regist_SR,
RAB_Att_Voice = y.RAB_Att_Voice,
RAB_STP_and_ACC_CR_Voice = y.RAB_STP_and_ACC_CR_Voice,
RAB_SR_AMR_Voice = y.RAB_SR_AMR_Voice,
Min_per_Drop_Voice = y.Min_per_Drop_Voice,
CS_Serv_Dur_Voice = y.CS_Serv_Dur_Voice,
RAB_Att_UDI = y.RAB_Att_UDI,
RAB_Stp_Acc_SR = y.RAB_Stp_Acc_SR,
RAB_SR_UDI = y.RAB_SR_UDI,
Min_Per_Drop_UDI = y.Min_Per_Drop_UDI,
CS_Serv_Dur_UDI = y.CS_Serv_Dur_UDI,
PS_NRT_RAB_Att = y.PS_NRT_RAB_Att,
PS_NRT_RAB_CR = y.PS_NRT_RAB_CR,
PS_NRT_RAB_SR_NW = y.PS_NRT_RAB_SR_NW,
PS_NRT_RAB_SR_User = y.PS_NRT_RAB_SR_User,
Packet_Session_Att = y.Packet_Session_Att,
Packet_Session_Stp_SR = y.Packet_Session_Stp_SR,
RAB_Att_Stream = y.RAB_Att_Stream,
RAB_Stp_Acc_SR_Stream = y.RAB_Stp_Acc_SR_Stream,
RAB_SR_Stream = y.RAB_SR_Stream,
M_RAB_Att = y.M_RAB_Att,
M_RAB_Stp_Acc_SR = y.M_RAB_Stp_Acc_SR,
M_RAB_SR = y.M_RAB_SR,
SHO_Update_Att_RT = y.SHO_Update_Att_RT,
SHO_Update_Att_NRT = y.SHO_Update_Att_NRT,
SHO_SR_RT = y.SHO_SR_RT,
SHO_SR_NRT = y.SHO_SR_NRT,
SHO_Overhead = y.SHO_Overhead,
Inter_Sys_HHO_Att_RT = y.Inter_Sys_HHO_Att_RT,
Inter_Sys_HHO_Att_NRT = y.Inter_Sys_HHO_Att_NRT,
Inter_Sys_HHO_RT_SR = y.Inter_Sys_HHO_RT_SR,
Inter_Sys_HHOO_NRT_SR = y.Inter_Sys_HHOO_NRT_SR,
Inter_Sys_HHO_RT_DR = y.Inter_Sys_HHO_RT_DR,
Inter_Sys_HHO_NRT_DR = y.Inter_Sys_HHO_NRT_DR,
Inc_IS_Change_Att = y.Inc_IS_Change_Att,
Intra_Sys_HHO_Att = y.Intra_Sys_HHO_Att,
Intra_Sys_HHO_SR = y.Intra_Sys_HHO_SR,
R99_Allo_DL_DCH_Cap_Data_Call = y.R99_Allo_DL_DCH_Cap_Data_Call,
R99_Allo_UL_DCH_Cap_Data_Call = y.R99_Allo_UL_DCH_Cap_Data_Call,
HSDSCH_Selections = y.HSDSCH_Selections,
HSDPA_Res_Acc_NRT = y.HSDPA_Res_Acc_NRT,
HSDPA_Res_Retain_NRT = y.HSDPA_Res_Retain_NRT,
HSDPA_Res_Retain_RT = y.HSDPA_Res_Retain_RT,
HSDPA_Attempt = y.HSDPA_Attempt,
HSDPA_SR = y.HSDPA_SR,
Avg_MAC_D_THP = y.Avg_MAC_D_THP,
Act_HSDSCH_MAC_D_THP_NW = y.Act_HSDSCH_MAC_D_THP_NW,
HSDPA_DL_DATA_Rcvd_NodeB = y.HSDPA_DL_DATA_Rcvd_NodeB,
HSDPA_MAC_HS_Data_Vol_at_RNC = y.HSDPA_MAC_HS_Data_Vol_at_RNC,
HSPDA_MAC_HS_Efficiency = y.HSPDA_MAC_HS_Efficiency,
HARQ_Non_Ack_Ratio_Mean = y.HARQ_Non_Ack_Ratio_Mean,
HSDPA_SCC_Att = y.HSDPA_SCC_Att,
E_DCH_Selections = y.E_DCH_Selections,
HSUPA_Res_Acc_NRT = y.HSUPA_Res_Acc_NRT,
HSUPA_Res_Retain_NRT = y.HSUPA_Res_Retain_NRT,
HSUPA_Res_Retain_RT = y.HSUPA_Res_Retain_RT,
HSUPA_Att = y.HSUPA_Att,
HSUPA_SR = y.HSUPA_SR,
HSUPA_MAC_es_Data_Vol_RNC = y.HSUPA_MAC_es_Data_Vol_RNC,
HSUPA_MAC_es_BLER = y.HSUPA_MAC_es_BLER,
E_DCH_HARQ_Non_Ack_Ratio = y.E_DCH_HARQ_Non_Ack_Ratio,
HSUPA_SCC_Att = y.HSUPA_SCC_Att,
AVG_CS_Traffic = y.AVG_CS_Traffic,
Inc_SMS_Att = y.Inc_SMS_Att
};
Chart1.DataSource = q;
Chart1.Series[0].XValueMember = "PeriodStartTime";
Chart1.Series[0].YValueMembers = HiddenFieldSeries1.Value.ToString();
Chart1.Series.Add(HiddenFieldSeries2.Value);
Chart1.Series[1].XValueMember = "PeriodstartTime2";
Chart1.Series[1].YValueMembers = HiddenFieldSeries2.Value.ToString();
}
}
Can We simplify Linq Select New codes?? while i only need 4 columns only.. :(
Your question dosen't make too much sense as far as your comments/labeling, so I took my best guess:
DDLLessons.DataSource = lesson;
DDLLessons.DataBind();
var query = from x in db.Scores
where x.StudentName == DDLStudentName.SelectedItem.Value
select new {
Day = x.Day,
Class = DDLLessons.SelectedItem.Value
};
Are you looking for selecting table name dynamically using strings (this is what I understood). If yes, have a look at this and select the table object from the string:
How can I dynamically select my Table at runtime with Dynamic LINQ
From the above link, this is what is relevant to you:
'' get the table from a type (which corresponds to a table in your database)
Dim typeName = "DatabaseTest.AdventureWorks." & tableName & ", DatabaseTest"
Dim entityType = Type.GetType(typeName)
Dim table = dc.GetTable(entityType)
Dim query As IQueryable = table
(credit for the code goes to original poster of the answer on the link that I've provided)
UPDATE: C# version of code:
// get the table from a type (which corresponds to a table in your database)
string typeName = "DatabaseTest.AdventureWorks." + tableName + ", DatabaseTest";
Type entityType = Type.GetType(typeName);
object table = dc.GetTable(entityType);
IQueryable query = table as IQueryable;

Pie Chart legend text

I am trying to display the label name and percentage in the legend of pie chart that I have in VB.NET. Below is the code. I cannot find any library reference or code samples to lead me in the right direction that works in VB.NET. The pie chart looks and works fine except for this.
Can anyone help?
thanks
PieTable.Columns.Add("Status")
PieTable.Columns.Add("Count")
PieTable.Rows.Add("Pass", LineCounter - FailCnt - WarningCnt)
PieTable.Rows.Add("Fail", FailCnt)
PieTable.Rows.Add("Warning", WarningCnt)
OverallPieChart.DataSource = PieTable
OverallPieChart.Width = 250
OverallPieChart.Height = 100
OverallPieChart.Series("Series1").XValueMember = "Status"
OverallPieChart.Series("Series1").YValueMembers = "Count"
OverallPieChart.EnableViewState = True
OverallPieChart.Series("Series1").ChartType = SeriesChartType.Pie
OverallPieChart.ChartAreas("ChartArea1").BackColor = Color.Black
OverallPieChart.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
OverallPieChart.BackColor = Color.Black
'OverallPieChart.Series(0)("PieLabelStyle") = "Outside (#Percent)"
OverallPieChart.Series(0).LabelForeColor = Color.Beige
OverallPieChart.ChartAreas("ChartArea1").InnerPlotPosition.Width = 100%
OverallPieChart.ChartAreas("ChartArea1").InnerPlotPosition.Height = 100%
OverallPieChart.Series(0)("PieLineColor") = "Transparent"
OverallPieChart.Series(0)("LabelsRadialLineSize") = "0.15"
OverallPieChart.Series(0)("LabelsHorizontalLineSize") = "0.15"
OverallPieChart.Legends.Add("Legent1")
OverallPieChart.Legends("Legend1").Enabled = True
OverallPieChart.Legends("Legend1").Docking = Docking.Right
OverallPieChart.Legends("Legend1").Alignment = System.Drawing.StringAlignment.Far
OverallPieChart.Legends("Legend1").BackColor = Color.Black
OverallPieChart.Series("Series1").IsVisibleInLegend = True
This should do it:
OverallPieChart.Series(0).Label = "#PERCENT"
Or you can use this:
OverallPieChart.Series(0).Label = "#PERCENT{P0}"
to round to the nearest whole number
For the label and the percentage:
OverallPieChart.Series(0)Label = "#VALX" & Environment.NewLine & "#PERCENT{P0}"
You have a typo in your code
OverallPieChart.Legends.Add("Legent1")
should be
OverallPieChart.Legends.Add("Legend1")

Resources