Replace String with System Setting Variable in Edit Page Schema

Below is my string which I need to replace with my value:

"The number of concert halls is limited and no more than ${maxAllowedDailyPrograms} daily programs can be active at a time."

 

How I can replace 'maxAllowedDailyPrograms' with value.

Please help

Like 0

Like

2 comments

Hi Riddhi,

Firstly, You need to create virtual attribute

In methods you can set value to system setting value using Terrasoft.SysSettings.querySysSettingsItem()

I have attached code for your reference 

attributes: {

            "SystemSettingValue": {

            dataValueType: this.Terrasoft.DataValueType.INTEGER,

            type: this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

            "value": 0

            },

        },

In methods,

onEntityInitialized: function() {

                this.callParent(arguments);

                Terrasoft.SysSettings.querySysSettingsItem("maxAllowedDailyPrograms", 

                    function(maxAllowedDailyPrograms) {

                        this.set("SystemSettingValue", maxAllowedDailyPrograms);

                }, this);

            }

Regards,

Akshaya Gajendran

 

Hi Riddhi

You need to save string text as localizable strings in the required edit page schema. While saving, save the string as below,



Name: UsrAlertText

Value: "The number of concert halls is limited and no more than {0} daily programs can be active at a time."

 

As Akshaya mentioned above, you can get the system setting value using the code given by her. The replacement of text can be done using the below mentioned code.

var Text = Ext.String.format(this.get("Resources.Strings.UsrAlertText"),SystemSettingValue);

Here, in Text variable you will get the needed text.

 

Regards

Abinaya

Show all comments