Concatenating row values in x++ - x++

In AX 2012, Is there a way to display values from multiple rows in a single column like the way we have in SQL by using 'stuff' and 'for xml path keywords':
https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/

No, there is no such thing. It cannot be done using X++ SQL alone.
Feel free to loop around and use a map of sets.

Related

Hyperion interactive reporting and JDEdwards

I am new using it, and have a question.
I need to join two files using a field that has different length.
In the file01. the field is text (3 characters) in the file02 the field is text (8 characters), both fieold has the data to the rigth side ( with spaces before)
So i need make some someting like that: trim(file01.field)=trim(file02.field).
Can you help me?. I don't know how to make advanced joins in Oracle Hyperion Interactive..
I really appreciate your help
you are working with local results and you have less options.
Try:
- import file01, after importing add a new computed item to join with Rtrim function;
- do the same to the file02
- insert a new query, go to local results and add the files (tables) to console and join this two tables by the new key.
Hugo

Multiple response crosstabs/frequencies based on categorical variable in SPSS

I've just started using SPSS after using R for about five years (I'm not happy about it, but you do what your boss tells you). I'm just trying to do a simple count based on a categorical variable.
I have a data set where I know a person's year of birth. I've recoded into a new variable so that I have their generation as a categorical variable, named Generation. I also have a question that allows for multiple responses. I want a frequency of how many times each response was collected.
I've created a multiple response variable (analyze>multiple response > Define variable sets). However, when I go to create crosstabs, the Generation variable isn't an option to select. I've tried googling, but the videos I have watched have the row variables as numeric.
Here is a google sheet that shows what I have and what I'm looking to achieve:
https://docs.google.com/spreadsheets/d/1oIMrhYv33ZQwPz3llX9mfxulsxsnZF9zaRf9Gh37tj8/edit#gid=0
Is it possible to do this?
First of all, to double check, when you say you go to crosstabs, is this Analyze > Multiple Response > Crosstabs (and not Analyze > Descriptive Statistics > Crosstabs)?
Second, with multiple response data, you are much better off working with Custom Tables. Start by defining the set with Analyze > Custom Tables > Multiple Response Sets. If you save your data file, those definitions are saved with it (unlike the Mult Response Procedure).
Then you can just use Custom Tables to tabulate mult response data pretty much as if it were a regular variable, but you have more choices about appropriate statistics, tests of significance etc. No need in the CTABLES code to explicitly list the set members.
Try CUSTOM TABLES, although this is an additional add-on modules that you need to have a licence for:
CTABLES /TABLE Generation[c] by (1_a+ 1_b + 1_c)[s][sum f8.0 'Count'].

Creating dictionaries from large data sets in a spreadsheet or database file

Currently the data I want to incorporate into my dictionary is in two fields of an Excel spreadsheet and also in two fields of a database in FileMaker Pro.
Is there an easy way to create a Swift dictionary from this data?
FileMaker field [calculation, text] =
"var dict = [" &
executesql("SELECT keyfield, valuefield FROM table" ;":";"," ) &
"]"
produces code to create a swift dictionary of all records of 'table'.
~jens
edit: 'executesql' requires a rather recent FileMaker version, I think 12 or 13.
I'm not a swift programmer, just a FileMaker dev, but Jens' answer looks like the best one to me. If you're not familiar with FileMaker Pro, the easiest way to apply that might just be by creating a new GLOBAL field in 'table' and making it a "Calculated" field (make sure to set the result type to Text). Here's a sample file: http://cris.lc/d5zjl
I would add that if you're using FileMaker 11, there are plugins (like BaseElements) that will let you perform SQL queries -- the calculation function would be slightly different, though.
Reply here or PM me if you still need help in FileMaker!

Kendo Grid not sorting an alphanumeric column properly (Natural sort)

I am using Kendo Grid in my asp.net mvc 4 project. I have the latest version of Kendo UI. One of the columns on the grid has data like (initially unsorted) ..
MS1
MS2
MS3
MS2345
MS4
When I sort the column the data is displayed as ...
MS1
MS2
MS2345
MS3
MS4
Instead of ...
MS1
MS2
MS3
MS4
MS2345
This is what I am expecting when I sort the column.
What am I doing wrong?
Edit:
Based on the information I have been given so far (thanks guys), what I want to do is Natural Sort. I have more than 100,000 records in the database. I am doing all the sorting and filtering on the server-side due to the large number of records in the system.
Solution:
The following solution didnt work for me as our system is very large but just in case you wanna know.
Telerik guys replied saying "In order to do this you need to use custom binding. Then you would have full control over data operations such as paging and sorting. I found a few good resources how to implement natural sorting in .NET: http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting "
As #StephenByrne said string sorting works as your result. In order to achieve what you are looking for you should perform "natural sort"
What you can do is: in kendo grid, make the column as non-sort-able. Then using JavaScript click event fire any of below approaches to perform "natural sort"
Here are few examples how you can achieve this
http://my.opera.com/GreyWyvern/blog/show.dml/1671288
https://github.com/overset/javascript-natural-sort
https://stackoverflow.com/a/2802804/942855
http://www.bennadel.com/blog/2495-User-Friendly-Sort-Of-Alpha-Numeric-Data-In-JavaScript.htm

Crystal Reports parameterized queries

The company I work for is using MacolaES for an ERP system. The SQL Server database is structured such that when things are no longer considered active, they are moved from a set of "active" tables to a set of "history" tables. This helps to keep the "active" tables small enough that queries return quickly. On the flip side, the history tables are enormous. The appropriate columns are indexed in these tables, and if you query for something specific it returns quickly.
The problem is when you make a Crystal Report, which is prompting the user for a parameter. For reasons not known to me, Crystal parameters are not translated into SQL parameters, so you end up with queries selecting everything from the order header history table inner joined to everything in the order lines history table, which results in over 8 million rows.
Is there a way to get Crystal Reports to use the parameters in the SQL query instead of loading all the records and filtering after the fact? I read somewhere that a stored procedure should work, but I'm curious if an ordinary parameterized query is possible in the interest of saving my time.
Here is the selection formula:
(
trim({Orderheader.ord_no}) = {?Order No}
)
and
(
{Orderheader.ord_type} = 'O'
)
and
(
{orderlines.ord_type} = 'O'
)
In Crystal Reports top menu go to Report / Selection Formulas / Record... There you can add a formula similar to:
{table.field1} = {?Parameter1} and {table.field2} = {?Parameter2}
That will add the condition to the where statement of the SQL query that the report will use to pull the rows.
To verify what is the condition in the where statement that the report is using to pull the data you can go to the menu database / Show SQL Statement. That way you can verify that the report is using the parameters in the filter.
Crystal Reports 8.5 User Guide mention the following tips:
To push down record selection, you
must select “Use Indexes or Server for
Speed” in the Report Options dialog
box (available on the File menu).
In record selection formulas, avoid data
type conversions on fields that are
not parameter fields. For example,
avoid using ToText( ) to convert a
numeric database field to a string
database field.
You are able to push down some record selection formulas
that use constant expressions.
Your formula has a TRIM function on a field. The function against the field does not allow Crystal to push the formula to the database because is not a constant expression.
If you really need to trim the order number field you should do it using SQL Expressions.
References:
Check out this article.

Resources