Hi all,
I am using a view as the data source for an entity-backed record. I have a field "Student Full Name" in the view, which I am getting by concatenating "Student First Name" and "Candidate Last Name" using the function concat("studLastNm", ", ", "studFirstNm").
So, for example, in the view and record the student full name will be displayed as "Brewer, Allan". There are no null or empty values in "Student Last Name". My CDT for view has primary key. When I sort the view for "Student Full Name" in the cloud database, the values are getting sorted properly. But the same in the record gives the following error:
The alias [[field=STUDENT_FULL_NM, ascending=true]] cannot be used because it contains illegal characters. The alias must contain only letters, numbers, and underscores, and must start with a letter. (APNX-1-4203-009)
Does the record sorting not work when the field has commas?
Can someone help me to fix this issue? Thanks.
Discussion posts and replies are publicly visible
I think the issue is that the alias for the concat is "Student Full Name". Appian does not support field names containing spaces. Changing this to e.g. "Student_Full_Name" should do it.
But my field name in the view and CDT is STUDENT_FULL_NM Stefan
OK. What is your queryEntity code?
I have created a view from the student table to get student full name. I am using this view as a datasource for my entity-backed record where the "STUDENT_FULL_NM" sorting is giving the error. The SQL coding for view is as follows:
CREATE OR REPLACE VIEW `TEST_VW_Student` ASSELECT `Student`.`STUDENT_ID` AS `STUDENT_ID`, `Student`.`STUDENT_F_NM` AS `STUDENT_F_NM`, `Student`.`STUDENT_M_NM` AS `STUDENT_M_NM`, `Student`.`STUDENT_L_NM` AS `STUDENT_L_NM`,CAST( CONCAT( CASE WHEN `Student`.`STUDENT_L_NM` = ' ' OR `Student`.`STUDENT_L_NM` IS NULL THEN 'Last Name' ELSE `Student`.`STUDENT_L_NM` END, ', ', `Student`.`STUDENT_F_NM`, ' ', CASE WHEN `Student`.`STUDENT_M_NM` = ' ' OR `Student`.`STUDENT_M_NM` IS NULL THEN '' ELSE `Student`.`STUDENT_M_NM`END) AS CHAR(100) CHARSET utf8mb4) AS `STUDENT_FULL_NM`
Where exactly are you implementing your sort on this field? Is it in an Interface object? If so, please provide the code for that Interface.
Seems to be OK. By any chance, the piece
"alias [[field=STUDENT_FULL_NM, ascending=true]]" in the error message does not match.
Could it be that you entered that in a wrong field or typed it as a string (in quotes) instead of code?
I have created the recordtype from the view as the data source. The record list field is giving error while sorting
I don't think so. The following is a part of XSD definition for TEST_VW_Student CDT:
<xsd:element name="STUDENT_FULL_NM" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="STUDENT_FULL_NM", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element>
But the view in cloud database does not have the primary key. By any chance, is the error due to that?
I meant the record list configuration.
Hi Stefan,
Thanks for your reply.
I am using this "STUDENT_FULL_NM" in the view as a link field. The following is the configuration for the link field:
a!recordLink( label: rf!STUDENT_FULL_NM, recordType:rp!type,identifier:rp!id)
It gives the alias error which I mentioned only in the link field, when I use it in the normal text field in the record list it is sorting properly and does not give any error.
The Appian version I am using is 21.1. Any suggestion?