Day of Week problem Language
Day of Week problem Language
Hi everyone .
I applied this formula to receive the day of the week (calculated Fields) but it is returned to me in English. how do I get it in Italian ?? Thanks
I applied this formula to receive the day of the week (calculated Fields) but it is returned to me in English. how do I get it in Italian ?? Thanks
Re: Day of Week problem Language
Can you post the formula
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Day of Week problem Language
OPS!!
this is the code calculated Fields
data_servizi is data from timepicker
this is the code calculated Fields
Code: Select all
SELECT DAYNAME(`Servizi`.`data_servizio`) FROM `Servizi`
WHERE `Servizi`.`id_servizio`='%ID%'
Re: Day of Week problem Language
Try
Code: Select all
SET @@lc_time_names = 'it_IT';SELECT DAYNAME(`Servizi`.`data_servizio`) FROM `Servizi`
WHERE `Servizi`.`id_servizio`='%ID%'
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Day of Week problem Language
hi, I replaced the query on the calculated field, but it doesn't work, remains empty
Re: Day of Week problem Language
Can you run
Code: Select all
SET lc_time_names = 'it_IT';SELECT DAYNAME(`Servizi`.`data_servizio`) FROM `Servizi`
WHERE `Servizi`.`id_servizio`='%ID%'
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Day of Week problem Language
Thanks, I tried the new code, but it doesn't work. empty field
- Attachments
-
- Immagine.jpg (116.15 KiB) Viewed 3293 times
Re: Day of Week problem Language
Hi,
after looking deeper into it, i'm afraid that this is not possible to do it via the calculated field.
All i could suggest is that you use replace(FIELD, SEARCH, TARGET) and use it multiple times for the whole week.
after looking deeper into it, i'm afraid that this is not possible to do it via the calculated field.
All i could suggest is that you use replace(FIELD, SEARCH, TARGET) and use it multiple times for the whole week.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Day of Week problem Language
Code: Select all
SELECT ELT(dayofweek(`FIELDNAME`), 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab')
FROM `TABLENAME`
WHERE `PKCOLUMN`='%ID%'
Just replace:
- FIELDNAME (your date field)
- TABLENAME your table name
- PKCOLUMN your primary key column name
Code: Select all
SELECT ELT(dayofweek(`data_servizio`), 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab')
FROM `Servizi`
WHERE `id_servizio`='%ID%'
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Day of Week problem Language
(2) different approach
Step 1:
Create a table (in your SQL tool or by code) and populate id's 1-7 with your localized weekday names, starting with 1=Sunday...7=Saturday.
Step 2:
Your calculated field SQL:
2nd approach is a bit more complicated but also more flexible for future purposes. If you only focus on one language, you do not even need the lang_code column but just id and name columns.
Regards,
Jan
Step 1:
Create a table (in your SQL tool or by code) and populate id's 1-7 with your localized weekday names, starting with 1=Sunday...7=Saturday.
Code: Select all
DROP TABLE IF EXISTS `i18n_weekdays`;
CREATE TABLE `i18n_weekdays` (
`id` int(11) NOT NULL,
`lang_code` varchar(5) NOT NULL,
`weekdayname` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `i18n_weekdays` (`id`, `lang_code`, `weekdayname`) VALUES
(1, 'de', 'Sonntag'),
(2, 'de', 'Montag'),
(3, 'de', 'Dienstag'),
(4, 'de', 'Mittwoch'),
(5, 'de', 'Donnerstag'),
(6, 'de', 'Freitag'),
(7, 'de', 'Samstag');
Your calculated field SQL:
Code: Select all
SELECT `i18n_weekdays`.`weekdayname`
FROM `TABLENAME` INNER JOIN `i18n_weekdays`
ON dayofweek(`TABLENAME`.`FIELDNAME`) = `i18n_weekdays`.`id`
AND `i18n_weekdays`.`lang_code` = 'de'
WHERE `TABLENAME`.`PKFIELDNAME`='%ID%'
Regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Day of Week problem Language
jsetzer wrote: ↑2020-07-06 21:15Please note that first entry in list of days is Sunday, because (by default) week starts on Sundays in MySQL databases.Code: Select all
SELECT ELT(dayofweek(`FIELDNAME`), 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab') FROM `TABLENAME` WHERE `PKCOLUMN`='%ID%'
Just replace:In your specific case:
- FIELDNAME (your date field)
- TABLENAME your table name
- PKCOLUMN your primary key column name
Code: Select all
SELECT ELT(dayofweek(`data_servizio`), 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab') FROM `Servizi` WHERE `id_servizio`='%ID%'
Great. Thanks, Solution 1 it works, but I only have one small problem. Eg (Mon = Monday) the problem is the accented letters, Monday = Monday? is it possible to solve this problem?
Re: Day of Week problem Language
Sorry, I do not understand.
You can change the resulting daynames to whatever you like, for example to strings having any international characters
Just replace the 7 entries 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab' by any different seven entries, wrapped in single-quotes, each
You can change the resulting daynames to whatever you like, for example to strings having any international characters
Code: Select all
SELECT ELT(dayofweek(`date`), 'äöü', 'ÄÖÜ', 'ß', 'áà ', 'â', 'Ææ', '♠♣♥♦')
FROM `vouchers`
Just replace the 7 entries 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab' by any different seven entries, wrapped in single-quotes, each
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Day of Week problem Language
I'm sorry, I didn't explain myself well.
I'll explain it with screens
I'll explain it with screens
- Attachments
-
- Schermata 2020-07-10 alle 21.09.08.png (112.2 KiB) Viewed 3144 times
-
- Schermata 2020-07-10 alle 21.08.33.png (33.01 KiB) Viewed 3144 times