Home > Forum > Rules, JS, SQL > [solved] Polish letters in item list

[solved] Polish letters in item list
0

[Webcon 2024.1.1.130] (i thin it was working in 2022.1.4.404 - but I need double check]


I have action to update item list where source is Parent Item list.

The sql query is working but filters .. works if there is no polish letters :|

so:
[code='SQL']
SELECT
d.DET_WFDID AS 'ID elementu',
d.{DCNCOL:1135} AS 'Sygnatura Audytu',
d.{DCNCOL:1132} AS 'Tytuł raportu 8D',
d.{DCNCOL:1131} AS 'Norma',
d.{DCNCOL:1128} AS 'Punkt normy',
d.{DCNCOL:1126} AS 'Opis',
d.{DCNCOL:1133} AS 'Załącznik',
d.DET_IsDeleted AS 'czy skasowany'
FROM
WFElementDetails d
WHERE
d.DET_WFCONID = {WFCON:3700} -- ID listy pozycji
AND d.DET_IsDeleted = 0 -- Filtr dla nienaruszonych pozycji
AND d.DET_WFDID = {WFD_WFDID} -- ID elementu rodzica
AND d.{DCNCOL:1132} = '{3205}' -- Jeśli 3205 jest wartością liczbową
[/code]

I genereted SQL (chat GPT)


SELECT
d.DET_WFDID AS 'ID elementu',
d.{DCNCOL:1135} AS 'Sygnatura Audytu',
d.{DCNCOL:1132} AS 'Tytuł raportu 8D',
LEN(d.{DCNCOL:1132}) AS 'Długość Tytułu z listy pozycji',
LEN('{3205}') AS 'Długość tekstu do porównania',
d.{DCNCOL:1132} COLLATE Polish_CI_AI AS 'Tytuł z listy pozycji z COLLATE',
'{3205}' COLLATE Polish_CI_AI AS 'Tekst do porównania z COLLATE',
d.{DCNCOL:1131} AS 'Norma',
d.{DCNCOL:1128} AS 'Punkt normy',
d.{DCNCOL:1126} AS 'Opis',
d.{DCNCOL:1133} AS 'Załącznik',
d.DET_IsDeleted AS 'czy skasowany'
FROM
WFElementDetails d
WHERE
d.DET_WFCONID = {WFCON:3695} -- ID listy pozycji
AND d.DET_IsDeleted = 0 -- Filtr dla nienaruszonych pozycji
AND d.DET_WFDID = {WFD_WFDID} -- ID elementu rodzica
-- AND LTRIM(RTRIM(d.{DCNCOL:1132})) COLLATE Polish_CI_AI = LTRIM(RTRIM('{3205}')) COLLATE Polish_CI_AI


and it looks like Item list column is max of characters of any item stored and all are "extended to max' O, so ... how to trim that :| ?

source >> item list

Check if COLLATE Polish_CS_AS instead of COLLATE Polish_CS_AI.
I also did not catch the problem, but if there is any concernig polish letters you can also use the dbo.RemoveDiactrics function, which removes polish letters. It should be available in your version. It works like this:

SELECT @replacedString = @stringToReplace
SELECT @replacedString = Replace(@replacedString COLLATE Polish_CS_AS, 'ą','a')

ex. SELECT dbo.RemoveDiactrics(Det_Att1) FROM....

Alternatively, there is option to add own function to scalar-valued functions on your data base.

In reply to: Arek Maziarczyk

Check if COLLATE Polish_CS_AS instead of COLLATE Polish_CS_AI.
I also did not catch the problem, but if there is any concernig polish letters you can also use the dbo.RemoveDiactrics function, which removes polish letters. It should be available in your version. It works like this:

SELECT @replacedString = @stringToReplace
SELECT @replacedString = Replace(@replacedString COLLATE Polish_CS_AS, 'ą','a')

ex. SELECT dbo.RemoveDiactrics(Det_Att1) FROM....

Alternatively, there is option to add own function to scalar-valued functions on your data base.

Thank you (All) for help and direction

I checked on 2 versions of Webcon 2022.1.4.404 and 2024.1.1.130
in bout it doesn't work ... so it is:
a) SQL / Webcon language/coding configuration on my site (my IT case)
b) no one is compares Text vs. text in webcon ;-) .. all use ID vs. ID ;-p

b) solution - I did that finally and it works, but still problem exist (on my site)

I did workaround (or proper configuration ;-) )
1) I start sub flow from Source Item list I copy Row element ID to tech field in subflow

2) then on path I do load of item list where I use
below SQL and compare That tech field with source Item list (from where I have element row ID) to pick the same Row - that way it works.


[Code]
SELECT
d.DET_WFDID AS 'ID elementu',
SUBSTRING(d.{DCNCOL:1153}, CHARINDEX('#', d.{DCNCOL:1153}) + 1, LEN(d.{DCNCOL:1153})) AS 'Sygnatura Audytu', -- Wyciągnięcie tekstu po #
-- d.{DCNCOL:1153} AS 'Sygnatura Audytu',
d.{DCNCOL:1150} AS 'Tytuł raportu 8D',
d.{DCNCOL:1149} AS 'Norma',
d.{DCNCOL:1148} AS 'Punkt normy',
d.{DCNCOL:1146} AS 'Opis',
d.{DCNCOL:1145} AS 'Załącznik',
d.{DETCOL:3700} AS 'ID wiersza',
d.DET_IsDeleted AS 'czy skasowany'
FROM
WFElementDetails d
WHERE
d.DET_WFCONID = {WFCON:3700} -- ID listy pozycji
AND d.DET_IsDeleted = 0 -- Filtr dla nienaruszonych pozycji
AND d.DET_WFDID = {WFD_WFDID} -- ID elementu rodzica
-- AND d.{DCNCOL:1150} = '{3205}' -- Jeśli 3205 jest wartością liczbową
AND d.{DETCOL:3700} = '{3846}' -- ID wiersza z listy pozycji vs. pole techniczne te same źródło
[/Code]

if I do: AND d.{DETCOL:3700} = '{3846}' -- ID wiersza z listy pozycji vs. pole techniczne te same źródło -- WORKS
-- AND d.{DCNCOL:1150} = '{3205}' -- porównanie text vs text z tego samego źródła - NOT WORKS


(I did the AS AI ect. configurtations and .. did not work ... so the problem is deeper than I have access to analyses it ...)
I will use Arek's option later to see what results it gives me ...

If You have time and would like to test then:

a) item list few records and text column with polish characters
b) start sub flow from that item list
c) copy text from "each" row to text attribute in "each" subflow [3 row = 3 subflow]
d) load item list from row text vs. text attribute (from sub flow start)

e) if it works on your webcon, that means it is not webcon and it is my SQL server configuration ...

Regards,
Paweł

In reply to: Michal Ciesiolkiewicz

You can try two methods:
1. As chatGPT wrote - change collation for Polish_CI_AI
2. Add 'N' letter before tour value - change collation too - " AND d.{DCNCOL:1132} = N'{3205}' "

In other place I needed to add your suggestion "N"
and it works ...

In other place I found I need that as business rule where I check if user have BPS account or not (in item list).

[CODE=SQL]
SELECT
COS_DisplayName AS 'Podwładny',
COS_ManagerDisplayName AS 'Manager',
COS_ID AS 'ID'
FROM
CacheOrganizationStructure
WHERE
COS_ManagerDisplayName COLLATE Polish_CI_AS = N'{3010}'
[/CODE]




I did
[code=sql]
SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation') AS DatabaseCollation
[/Code]

and .... in all my environments I have ... "Latin1_General_CI_AS"
and I should have "Polish_CS_AS" .....