I think this could save users a lot of time (this was really needed before Fabrik 4.x).
Capitalize labels using first letter of each word (separated by space)
When an existing table is used to create a fabrik list/elements - Fabrik will create elements with name of field in lowercase (all good) and will also use the name as the label (also in lower_case). This requires the user to manually update each of the labels to capitalize each word in label.
Would be great if Fabrik would attempt to capitalize the label with some logic on creation.
I have used and tested this function that did a great job on updating the labels in mass: https://stackoverflow.com/questions/4263272/capitalize-first-letter-mysql
Before function: 'event order status'
After function: 'Event Order Status'
Capitalize labels using first letter of each word (separated by space)
When an existing table is used to create a fabrik list/elements - Fabrik will create elements with name of field in lowercase (all good) and will also use the name as the label (also in lower_case). This requires the user to manually update each of the labels to capitalize each word in label.
Would be great if Fabrik would attempt to capitalize the label with some logic on creation.
I have used and tested this function that did a great job on updating the labels in mass: https://stackoverflow.com/questions/4263272/capitalize-first-letter-mysql
Before function: 'event order status'
After function: 'Event Order Status'
Code:
CREATE FUNCTION response(name VARCHAR(40)) RETURNS VARCHAR(200) DETERMINISTIC
BEGIN
set @m='';
set @c=0;
set @l=1;
while @c <= char_length(name)-char_length(replace(name,' ','')) do
set @c = @c+1;
set @p = SUBSTRING_INDEX(name,' ',@c);
set @k = substring(name,@l,char_length(@p)-@l+1);
set @l = char_length(@k)+2;
set @m = concat(@m,ucase(left(@k,1)),lcase(substring(@k,2)),' ');
end while;
return trim(@m);
END;
CREATE PROCEDURE updateNames()
BEGIN
SELECT response(name) AS name FROM names;
END;