Picture of mitop
Registered 3 years 291 days
mitop Wednesday, 16 March 2022, 01:00 PM
ConfigContext: From C++ to JavaScript Side
Hi all,

I have a little problem with the config class, maybe someone can provide a hint.
- https://sdk.innovaphone.com/13r2/sdk/common/lib/config.htm
- https://sdk.innovaphone.com/13r2/web1/config/config.htm

I created my own ConfigContext class on C++ side, derived vom JsonApiContext and ConfigContext. Creating/initializing/registering seems to work, writing to db too, exchanging values too, but after a restart of the app, the db values are not present, i always see the default values from the ConfigContext class on C++ side and on Javascript side, but the db contains the modified data what i can see with pgadmin.
Log file does not show any errors, get stucked a little bit. Any idea why i can write to the config db part, but values are not read by app-service nor front-end side after restarting the app?
I followed the code example here:
- https://sdk.innovaphone.com/13r2/sdk/common/lib/config.htm


Best regards
Mladen
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 121 days
Daniel Deterding (innovaphone) Wednesday, 16 March 2022, 01:27 PM
Re: ConfigContext: From C++ to JavaScript Side
Hi Mladen,

do you initialize the config after your DatabaseConnectComplete?

config->CreateInitTask()

This creates a task which must be started by your app.
If you enable database traces, you should see this query in the trace of the app:

SELECT name, value FROM config

Greetings,
Daniel
Picture of mitop
Registered 3 years 291 days
mitop Wednesday, 16 March 2022, 01:35 PM
Re: ConfigContext: From C++ to JavaScript Side
Hi Daniel,

yes i did that. I took the default ConfigClass, renamed it and added my values. I can see the "SELECT name, value FROM config" command...part of the log file attached..


Greeting
Mladen

config_log.txt
Picture of Daniel Deterding (innovaphone)
Moderator Registered 15 years 121 days
Daniel Deterding (innovaphone) Wednesday, 16 March 2022, 01:44 PM
Re: ConfigContext: From C++ to JavaScript Side
Do you set the unmanaged flag to true if you initialize a Config class like ConfigString?

This is a parameter of the constructor of the Config value classes.

If unmanager is true, the configuration value is not exchanged between C++ and JS.

Inside your TaskComplete of the init config task:
can you print configItem->Value() on C++ side? Do you then get the default value or the database value?

Greetings,
Daniel
Picture of mitop
Registered 3 years 291 days
mitop Wednesday, 16 March 2022, 02:03 PM
Re: ConfigContext: From C++ to JavaScript Side
- All the unmanaged flags of all Configitems added are set to false (not all items are used actually, but prepared for the next app version)

- Inside the TaskComplete function i do check for the default values, if the values in the database differ from the default values, the app should do something, what never happens because the configItem->Value() returns the default value, not that from the db

Can i provide more information?
- Inside the extended log (config ckeckmark activated) i can see that the ConfigItems are created and that the config table init task is called

Greeting
Mladen
Picture of mitop
Registered 3 years 291 days
mitop Thursday, 17 March 2022, 09:06 AM in response to mitop
Re: ConfigContext: From C++ to JavaScript Side
... got it ... seems that i called the CreateInitTask the wrong way, now it works as expected


← You can define your color theme preference here