Please can you help me fix this code
if(([User Email] ="#faccc.com") & "UID" &[User ID]&[User Email]) else [User Email]
could be anything
maybe
#"step" = if [User Email] ="#faccc.com" then "UID" &[User ID]&[User Email] else [User Email]
or
#"step" = if Text.EndsWith([User Email]) ="#faccc.com" then "UID" &[User ID]&[User Email] else [User Email]
Related
Mcode= Table.ReplaceValue(#"Renamed Columns2", each if Text.Contains([Rate_Card.Payee],"Financial Services") and [Externalidinvestorlevel] = null then null else [Rate_Card.Payee]
Error Message:
Expression.SyntaxError: Token RightParen expected.
I think maybe you want to do this
Mcode= Table.ReplaceValue(#"Renamed Columns2",
each [Rate_Card.Payee],
each if Text.Contains([Rate_Card.Payee],"Financial Services")
and [Externalidinvestorlevel] = null
then null else [Rate_Card.Payee]
,Replacer.ReplaceValue,{"Rate_Card.Payee"})
in #"Replaced Value"
I am trying to sort the datacube on the Aging Group column to appear in the following order 1-30, 31-60, 61-90 etc image located here - https://i.stack.imgur.com/Caoj8.jpg
I initially thought I would modify the sort option for ascending but it did not work. I tried to modify the data from "string" to "float", but I have one category listed as "Not Aged" (equivalent to 0) and it triggers errors.
I have built an expression to create a custom sort on the datacube, but it does not seem to be working.
var pattern = /^[N]/gi;
if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == 'Not Aged'){1}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '1-30'){2}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '31-60'){3}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '61-90'){4}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '91-120'){5}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '121-150'){6}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '151-180'){7}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '181-210'){8}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '211-240'){9}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '241-270'){10}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '271-300'){11}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '331-365'){12}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '331-365'){13}
else if (dimension["Group1"]["CATEGORY_DESCRIPTION"] == '366+'){14}
else {99}
The data is still displaying as per the screen shot and since "Not Aged" is 0 I'd like for it to be listed first.
Any suggestions on how to fix this issue?
I was finally able to figure it out!
On the datacube in the actual row cell -- I mapped the Not Aged to display as 0
On the datacube I then added an attribute of "age" to the Category Description. I was then able to sort on the DataCube using the following: dimension["Group1"]["CATEGORY_DESCRIPTION"]["DISCHARGE_AGE"] in the Ascending order.
I have a problem with definition of Set or variable.
In the following code:
[template public generateElement(d : DangerClass){ a:Set(AgentClass)=Set{};}]
[comment #main/]
[file (d.name + '.java', false, 'UTF-8')]
[for (h:Hazard | d.ownedHazard)]
[for (e:Element | h.entity) ]
[if (e.oclIsKindOf(AgentClass)) {a->including(e);}][/if]
[/for]
[/for]
[/file]
[/template]
the error ". expected instead of {" is shown.(Line 6)
If I write "[for (e:Element | h.entity) {a->including(e);}]" the error "variable a->including(e); is not valid" will be displayed.
I want to define a set ("a" as Set(AgentClass)) that "a" includes agents and I don`t want to print something.But I want to store agents in a set.
Can anyone help me?
Thanks
If you only want to store agent in a set (no atomic display), you can use let to define a variable that you can use in your further expressions:
[template public generateElement(d : DangerClass)]
[comment #main/]
[file (d.name + '.java', false, 'UTF-8')]
[let a : Set(AgentClass) = d.ownedHazard.entity->filter(AgentClass)->asSet()]
... handle 'a' in your future requests
[/let]
[/file]
[/template]
Variables are immutable in acceleo and OCL.
Just do this, for instance:
[for (agentClass : AgentClass | d.ownedHazard.entity->filter(AgentClass))]
(... here, generate something with agentClass ...)
[/for]
Can I use if clause with Linq where?
for example: I have a table with 4 filed(Id,UserId,Type,Sing).
I want select recorde that userid is 1 and if Type="None" , Sing should True.
(from d in db.Receive
where ((((d.SendType == "None") ? ((d.Signed) ? true : false) : true)) && userid==1)
select d).ToList();
when i use
((d.SendType == "None") ? ((d.Signed) ? true : false) : true)
it is select records that if Type="None" , Sing should True. but when add userid condition , don't return any records.
Isn't it better:
from d in db.Receive
where ((d.SendType == "None" && d.Signed) || d.SendType != "None") && userid == 1)
select d
and so?
(((d.SendType == "None") && (userid == 1)) ? ((d.Signed) ? true : false) : true)
Theres lots of brackets there...if I understand you correctly userid == 1 is used regardless so why not just have
where (((d.SendType == "None" && userid == 1) ? ((d.Signed) ? true : false) : true)))
select d).ToList();
I use will_paginate with ajax sort and seen railscasts.com.
http://railscasts.com/episodes/240-search-sort-paginate-with-ajax
My collection for pagination
#cars = Car.joins(:engine).includes(:engine).select('cars.*, engines.*').order(sort_column + " " + sort_direction).paginate(:page => params[:page], :per_page => 5)
But when I went to the index page, I jumped out error.
ActiveRecord::StatementInvalid in Items#index
SQLite3::SQLException: ambiguous column name: name: SELECT "cars"."id" AS t0_r0, "cars"."name" AS t0_r1, "cars"."model_id" AS t0_r2, "cars"."city_id" AS t0_r3, "cars"."created_at" AS t0_r4, "cars"."updated_at" AS t0_r5, "cars"."engine_id" AS t0_r6, "engines"."id" AS t1_r0, "engines"."name" AS t1_r1, "engines"."created_at" AS t1_r2, "engines"."updated_at" AS t1_r3 FROM "cars" INNER JOIN "engines" ON "engines"."id" = "cars"."engine_id" ORDER BY name asc LIMIT 5 OFFSET 0
But when I go to a page already sorted, it works for me.
I think mistake in default Order in SQL.
How to set 'cars.name' instead 'name'?
I found method and set sort default
private
def sort_column
Car.column_names.include?(params[:sort]) ? params[:sort] : "cars.name"
end