DocumentModel.randomValueDatabase - SmartJSONEditor/PublicDocuments GitHub Wiki

DocumentModel.randomValueDatabase(databaseType)

Parameters

# Type Description
1 String database type

Possible database types:

  • maleNames
  • femaleNames
  • surname
  • country
  • countryCode
  • USState
  • USStateCode
  • currencyName
  • currencyCode
  • color
  • loremIpsum

Return Value

Randomly selected value

Example

var ValueTransformer = function () {
    this.displayName = "Token Transformer";
    this.shortDescription = "Testing Log Function";
    this.isEditingDisabled = false;
    this.infoUrl = "https://github.com/SmartJSONEditor/PublicDocuments/wiki/Token-Value-Transformer";
    
    this.parameters = function (config) {
		
	if (config == null) {
	    return [];
	}
	// Construct your parameters
        return [];
    };
    
    this.transform = function (inputValue, parameters, userInfo) {
        let randomCountry = DocumentModel.randomValueDatabase("country");
        return randomCountry;
    };
}

function sjeClass() {
    return new ValueTransformer();
}