Question
Vodafone India Ltd
IN
Last activity: 23 Sep 2024 6:09 EDT
Size of property is causing issue while saving into Db
Text property has size -350 characters. User is entering 349 characters. This property is being used in declare index .Extra spaces are getting appended automatically to this property in the beginning and end which is not letting it save in DB when declare index is being referred. We cannot change size in DB as there are multiple properties where this issue is occurring.
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Maantic Inc
IN
At the place where the save is occurring can you perform a trim of the input property?
Maantic Inc
IN
I'm not talking in the declare index. Perform a trim somewhere before the save happens on the source class so that the trimmed value is indexed.
Eclatprime Digital Private Limited
AU
Hi @DeepaliP9967,
In Pega, extra spaces automatically added to a text property can cause issues, especially when the property is used in a Declare Index, and may result in failure to save data into the database. Since the database size cannot be changed, it's best to handle this within Pega by ensuring that extra spaces are trimmed before saving the value.
To resolve this issue, follow these steps:
1. Use a Property Post-Processing Rule to Trim Whitespaces: - Create an activity. - Add a Property-Set step. - Set the value of the property using the trim() function: .YourProperty = @(Pega-RULES:String).trim(.YourProperty) This ensures that any extra spaces are removed before saving to the Declare Index or database.
2. Use a Data Transform for Trimming: - In your data transform, add a Set action for the specific property. - Use the trim() function in the Data Transform: .YourProperty = @(Pega-RULES:String).trim(.YourProperty)
3. Handling in Declare Index (Optional): If the property is being referred to in a Declare Index, ensure that the trimming logic is applied before the indexing occurs.
Hi @DeepaliP9967,
In Pega, extra spaces automatically added to a text property can cause issues, especially when the property is used in a Declare Index, and may result in failure to save data into the database. Since the database size cannot be changed, it's best to handle this within Pega by ensuring that extra spaces are trimmed before saving the value.
To resolve this issue, follow these steps:
1. Use a Property Post-Processing Rule to Trim Whitespaces: - Create an activity. - Add a Property-Set step. - Set the value of the property using the trim() function: .YourProperty = @(Pega-RULES:String).trim(.YourProperty) This ensures that any extra spaces are removed before saving to the Declare Index or database.
2. Use a Data Transform for Trimming: - In your data transform, add a Set action for the specific property. - Use the trim() function in the Data Transform: .YourProperty = @(Pega-RULES:String).trim(.YourProperty)
3. Handling in Declare Index (Optional): If the property is being referred to in a Declare Index, ensure that the trimming logic is applied before the indexing occurs.
4. Pre-Validation for Input: If applicable, add pre-validation logic on the UI side to automatically trim input as soon as the user enters data.
5. Declare Expression (Optional): Alternatively, you can use a Declare Expression rule for this property to automatically invoke the trim logic whenever the property is updated.
6. Custom Validation in Validation Rule (Optional): If needed, create a Validation Rule for the property that checks for any extra spaces before saving the data.
In summary, to resolve the issue of extra spaces being appended to a text property when using Declare Index, you can trim the whitespace using a property post-processing rule, a data transform, or a declare expression. By applying the trim logic before the value is indexed or saved to the database, you can ensure the text remains within the character limit and avoid any save issues.
I hope it will help you to resolve your issue
Thanks
Raja
Vodafone India Ltd
IN
@Koti Raja Still not working. Tried all the options. When declare index is getting triggered extra spaces are added. During on change of the field no extra space is added
Eclatprime Digital Private Limited
AU