Spec for setting definitions using url encoding in ACP


ACP: URL Encoding of Model Input Data

By: Fred Brunton Date: August 27, 2011

Introduction

Based on desires of SAIC to get certain data into their model, we have developed a way for url encoding that data and having that data assigned to definitions of Variables when the model is played.

Example

I will first give you an example of how this feature is going to work, and then follow with the detailed specification. Let’s say you want to pass in the location info in the url, and have that information made the definition of the model Variable with identifier Loc. When using ACP, you include the location info in the query string at the end of the url used for playing ACP like so: https://www.analyticacloud.com/acp/client/acpClient.aspx?p_Loc=%27CA%2C%20USA%27 When the model is played, the Variable Loc is given the definition of ‘CA, USA’ – including the single quotes. In the above example p_Loc is a key and %27CA%2C%20USA%27 a value making a key/value pair.

Specification

Keys

The keys used for url encoding model input data will start with lower case letter ‘p’ followed by an underscore. The reason for this prefix is because ACP uses other url encoded keys, so the ‘p_’ prefix distinguishes model input data from other url encoded used by ACP. As is standard HTTP, keys and their values are followed by an equals sign From testing we have found there is no need to escape the underscore characters in the Keys. Escaping – i.e. encoding – is explained in the next section.

Values

The values of the keys are url encoded a.k.a. escaped. So special characters – such as $, &, :, ?, @ etc. – in the keys are not interpreted by the browser as having some other meaning. This encoding is already standardized by using a percent sign followed by the hexadecimal ASCII code. For example a space character is encoded as  %20. Fortunately, programming languages have functions for doing the escaping and un-escaping the Url – i.e. encoding and decoding. Note, when encoding Variable definitions that are text, you include the single or double quotes around the text. Otherwise the value will be misinterpreted as an expression.

Setting Multiple Variable Definitions

When encoding multiple definitions following standard HTTP conventions you separate the key/value pairs in the url with an ampersand character.

When Definition are Assigned

ACP assigns the Variables the url encoded definitions when the model is opened.

See Also

Comments


You are not allowed to post comments.