Adding text values in container in x++ - axapta

I have a AttributeTextValue field that stores value for the attributes, The values are in following format , 001,002,003 and so on , and one single attribute can contain multiple values seperated by comma such as
AttributeValue = 001,002,003
and to split each of the text I have used str2con and this stores each value seperated by comma in a container , but issue I am facing is that str2con convert the text value to str and stores strings in container as follows : 1,2,3 but I want it to be same as 001,002 and 003 . How to accomplish this can any one help me out ?

Use str2con(value, ',', false) with parameter _convertNumericToInt64 as false.
With this parameter container elements won't be converted to integer.

Related

get only numbers inside parenthesis filter or custom filter or what?

The string is "Some Words(1440)" and I want to store the numbers inside the parenthesis as a variable in twig so it can be output and used. I thought maybe I could do it with a split but I wasn't able to escape the parenthesis properly.
What I have:
Some Words (1440)
What I want to extract from the string is just the numbers in parenthesis
1440

Add leading zeros to a character variable in progress 4gl

I am trying to import a .csv file to match the records in the database. However, the database records has leading zeros. This is a character field The amount of data is a bit higher side.
Here the length of the field in database is x(15).
The problem I am facing is that the .csv file contains data like example AB123456789 wherein the database field has "00000AB123456789" .
I am importing the .csv to a character variable.
Could someone please let me know what should I do to get the prefix zeros using progress query?
Thank you.
You need to FILL() the input string with "0" in order to pad it to a specific length. You can do that with code similar to this:
define variable inputText as character no-undo format "x(15)".
define variable n as integer no-undo.
input from "input.csv".
repeat:
import inputText.
n = 15 - length( inputText ).
if n > 0 then
inputText = fill( "0", n ) + inputText.
display inputText.
end.
input close.
Substitute your actual field name for inputText and use whatever mechanism you are actually using for importing the CSV data.
FYI - the "length of the field in the database" is NOT "x(15)". That is a display formatting string. The data dictionary has a default format string that was created when the schema was defined but it has absolutely no impact on what is actually stored in the database. ALL Progress data is stored as variable length length. It is not padded to fit the display format and, in fact, it can be "overstuffed" and it is very, very common for applications to do so. This is a source of great frustration to SQL reporting tools that think the display format is some sort of length limit. It is not.

Update float data type field with blank spaces in sql

A blank space will be treated as 0 if using float:
for eg:
declare #f float
set #f = ''
print #f
I tried using blank spaces in the columns using update statement, the output will be 0.
But i want to save blank space and retrieve blackspace for field value.
How to possible this.
I am using to update table value from xml file,i am getting balnk value from xml file,but i save this,it will be saved like zero,but i wnat to save this as blank
I need to allow blank space for an decimal parameter how can we do that ?
In order to store a blank like you require in a float column, you need to make it nullable and save null value into this column.
Empty string ('') can only be saved into varchar, text and similar text columns.

How to filter two values for given single search?

How to show two records for given single search?
UI page contains millions of records.I need to show only two records instead of giving
single search.
using OR SEARCH or whatever use.I want to show two records.
And how can i give two values in single text box?
That dependa on you only, you can make use of some special charater to break two string like : or | so that you allow to etner two string like "abc|5678" than in back end you break this string in two string string1 = abc and string2=5678
Two values in single text box:
txt.Text = "value1" + "value2";

String Aggregation in sqlite

Anyone knows if String Aggregation in sqlite is possible?
If i have an animal column with 5 rows/datas, how can i combine them so that the output would be in one field
'dog','cat','rat','mice','mouse' as animals
Thanks
You're looking for something like the following:
select group_concat(animal) from animals;
This will return something like the following:
dog,cat,rat,mice,mouse
If you don't want to use a comma as the separator, you can add your own separator as a second parameter:
select group_concat(animal, '_') from animals;
which will return:
dog_cat_rat_mice_mouse
I think this will be useful:
group_concat(X)
group_concat(X,Y)
The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then it is used as the separator between instances of X. A comma (",") is used as the separator if Y is omitted. The order of the concatenated elements is arbitrary.

Resources