This commit is contained in:
2021-11-17 01:00:35 +00:00
parent ffeacb93d0
commit 0372e13cf3
2 changed files with 28 additions and 8 deletions

View File

@@ -234,22 +234,40 @@ Most of these properties are intended to be used by the translation and localiza
When a report is rendered some settings from the local AyaNova Server are injected into the report data and are used as required to access local server relative settings. For example the URL path to the local AyaNova server's API so that API methods can be called directly in the report template relative to the server's local path.
You can see what data is provided by using the ayJson helper as in the example above on the report. As of the time of this writing the current values provided are:
You can see what data is provided by using the ayJson helper as in the example above on the report. For example:
```
ayServerMetaData:
{
"ayApiUrl": "http://127.0.0.1:7575/api/v8/",
"HasSmallLogo": true,
"HasMediumLogo": true,
"HasLargeLogo": true
{
"ayApiUrl": "http://127.0.0.1:7575/api/v8/",
"HasSmallLogo": true,
"HasMediumLogo": true,
"HasLargeLogo": true,
"CompanyName": "GZ TestCo Inc.",
"CompanyWebAddress": "www.example.org",
"CompanyEmailAddress": "Daphney.Brakus@example.org",
"CompanyPhone1": "433-762-9299 x359",
"CompanyPhone2": "722-660-1804",
"HasPostalAddress": true,
"CompanyPostAddress": "2523 Keshaun Mission",
"CompanyPostCity": "Port Wilfred",
"CompanyPostRegion": "ExamplePostRegion",
"CompanyPostCountry": "ExamplePostCountry",
"CompanyPostCode": "98218",
"HasStreetAddress": true,
"CompanyAddress": "980 General Brook",
"CompanyCity": "Port Wilfred",
"CompanyRegion": "ExampleRegion",
"CompanyCountry": "ExampleCountry",
"CompanyLatitude": 13.6747,
"CompanyLongitude": -70.6925
}
```
(Note: this is an example only, your server may be different)
* ayApiUrl - this is the URL of the server relative to the report generator and is useful for calling AyaNova API methods in your prepare data function to bring in sources of information from other areas of AyaNova that might not be directly available to your report
* HasXXLogo - these keys are set to true if a Logo has been uploaded for each size to AyaNova and are useful for controlling whether or not to show a logo on a report template as can be seen in many of our sample reports
* Company XXX fields - these fields represent your company information as entered in Global settings to provide a centralized source of information for all reports requiring company contact or address data
### Accessing top level meta data from inside nested objects

View File

@@ -612,7 +612,9 @@ namespace AyaNova.Biz
if (logo.Medium != null) HasMediumLogo = "true";
if (logo.Large != null) HasLargeLogo = "true";
}
var serverMeta = $"{{ayApiUrl:`{apiUrl}`, HasSmallLogo:{HasSmallLogo}, HasMediumLogo:{HasMediumLogo}, HasLargeLogo:{HasLargeLogo},CompanyWebAddress:`{ServerGlobalBizSettings.Cache.WebAddress}`,CompanyEmailAddress:`{ServerGlobalBizSettings.Cache.EmailAddress}`,CompanyPhone1:`{ServerGlobalBizSettings.Cache.Phone1}`,CompanyPhone2:`{ServerGlobalBizSettings.Cache.Phone2}`,CompanyPostAddress:`{ServerGlobalBizSettings.Cache.PostAddress}`,CompanyPostCity:`{ServerGlobalBizSettings.Cache.PostCity}`,CompanyPostRegion:`{ServerGlobalBizSettings.Cache.PostRegion}`,CompanyPostCountry:`{ServerGlobalBizSettings.Cache.PostCountry}`,CompanyPostCode:`{ServerGlobalBizSettings.Cache.PostCode}`,CompanyAddress:`{ServerGlobalBizSettings.Cache.Address}`,CompanyCity:`{ServerGlobalBizSettings.Cache.City}`,CompanyRegion:`{ServerGlobalBizSettings.Cache.Region}`,CompanyCountry:`{ServerGlobalBizSettings.Cache.Country}`,CompanyLatitude:{ServerGlobalBizSettings.Cache.Latitude},CompanyLongitude:{ServerGlobalBizSettings.Cache.Longitude}}}";
var HasPostalAddress=!string.IsNullOrWhiteSpace(ServerGlobalBizSettings.Cache.PostAddress)?"true":"false";
var HasStreetAddress=!string.IsNullOrWhiteSpace(ServerGlobalBizSettings.Cache.Address)?"true":"false";
var serverMeta = $"{{ayApiUrl:`{apiUrl}`, HasSmallLogo:{HasSmallLogo}, HasMediumLogo:{HasMediumLogo}, HasLargeLogo:{HasLargeLogo},CompanyName: `{AyaNova.Core.License.ActiveKey.RegisteredTo}`,CompanyWebAddress:`{ServerGlobalBizSettings.Cache.WebAddress}`,CompanyEmailAddress:`{ServerGlobalBizSettings.Cache.EmailAddress}`,CompanyPhone1:`{ServerGlobalBizSettings.Cache.Phone1}`,CompanyPhone2:`{ServerGlobalBizSettings.Cache.Phone2}`,HasPostalAddress:{HasPostalAddress},CompanyPostAddress:`{ServerGlobalBizSettings.Cache.PostAddress}`,CompanyPostCity:`{ServerGlobalBizSettings.Cache.PostCity}`,CompanyPostRegion:`{ServerGlobalBizSettings.Cache.PostRegion}`,CompanyPostCountry:`{ServerGlobalBizSettings.Cache.PostCountry}`,CompanyPostCode:`{ServerGlobalBizSettings.Cache.PostCode}`,HasStreetAddress:{HasStreetAddress},CompanyAddress:`{ServerGlobalBizSettings.Cache.Address}`,CompanyCity:`{ServerGlobalBizSettings.Cache.City}`,CompanyRegion:`{ServerGlobalBizSettings.Cache.Region}`,CompanyCountry:`{ServerGlobalBizSettings.Cache.Country}`,CompanyLatitude:{ServerGlobalBizSettings.Cache.Latitude},CompanyLongitude:{ServerGlobalBizSettings.Cache.Longitude}}}";
log.LogDebug($"Preparing page: adding Report meta data");