Difference between revisions of "JavaScript Data Injection Campaigns"
From All n One's bxp software Wixi
Philip Lacey (talk | contribs) |
Philip Lacey (talk | contribs) |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
As with self referencing campaigns BE has the ability to dynamically lookup data from an existing campaign. Unlike self referencing campaigns, you may wish to retrieve data from another campaign which is also possible. So if data can be retrieved it can also be inserted into fields to save on data repitition. A data injection is looking up data from a campaign and then inserting the retrieved data (if there is any) into fields in the current campaign. This can save a ton of data entry for users. | As with self referencing campaigns BE has the ability to dynamically lookup data from an existing campaign. Unlike self referencing campaigns, you may wish to retrieve data from another campaign which is also possible. So if data can be retrieved it can also be inserted into fields to save on data repitition. A data injection is looking up data from a campaign and then inserting the retrieved data (if there is any) into fields in the current campaign. This can save a ton of data entry for users. | ||
| + | |||
The setup of the retrieval is exactly the same as a self referencing campaign. It is useful to do self referencing first to ensure the data is being retrieved correctly. | The setup of the retrieval is exactly the same as a self referencing campaign. It is useful to do self referencing first to ensure the data is being retrieved correctly. | ||
| + | |||
| + | [[JavaScript_Self-Referencing_Campaigns]] | ||
| + | |||
Once the data is retrieved with two small changes, the retrieved data can be inserted into the desired fields. | Once the data is retrieved with two small changes, the retrieved data can be inserted into the desired fields. | ||
| + | |||
Examining the self referencing function | Examining the self referencing function | ||
| + | |||
<syntaxhighlight lang="javascript" line="1"> | <syntaxhighlight lang="javascript" line="1"> | ||
| Line 26: | Line 32: | ||
aryAjax_Settings[14] = "true"; //Click through to campaign? | aryAjax_Settings[14] = "true"; //Click through to campaign? | ||
aryAjax_Settings[15] = "divWarning"; //The id of the destination to which the table will be inserted | aryAjax_Settings[15] = "divWarning"; //The id of the destination to which the table will be inserted | ||
| − | aryAjax_Settings[16] = "Insert"; | + | aryAjax_Settings[16] = "Insert"; //The types of processing. Table or Insert |
//The fields to be returned into the array | //The fields to be returned into the array | ||
| Line 41: | Line 47: | ||
Changes are required to line 19 and line 26. | Changes are required to line 19 and line 26. | ||
| + | |||
Line 19, needs to have the key word "Insert" instead of "Table" | Line 19, needs to have the key word "Insert" instead of "Table" | ||
| + | |||
Line 26, is the list of fields in the current campaign, into which the data will be inserted. The fields in line 24 will be loaded into the corresponding fields in line 26. i.e. in the demo above strCDA_1_field_0_0 will be loaded into strCDA_2_field_0_24 | Line 26, is the list of fields in the current campaign, into which the data will be inserted. The fields in line 24 will be loaded into the corresponding fields in line 26. i.e. in the demo above strCDA_1_field_0_0 will be loaded into strCDA_2_field_0_24 | ||
| + | |||
Whilst testing it is useful to change back to the "Table" setup to ensure the correct data is being retrieved. | Whilst testing it is useful to change back to the "Table" setup to ensure the correct data is being retrieved. | ||
| − | [[Category:JavaScript]] | + | |
| + | [[Category:Topic:bxp API]] | ||
| + | [[Category:Topic:JavaScript]] | ||
Latest revision as of 21:46, 9 November 2014
As with self referencing campaigns BE has the ability to dynamically lookup data from an existing campaign. Unlike self referencing campaigns, you may wish to retrieve data from another campaign which is also possible. So if data can be retrieved it can also be inserted into fields to save on data repitition. A data injection is looking up data from a campaign and then inserting the retrieved data (if there is any) into fields in the current campaign. This can save a ton of data entry for users.
The setup of the retrieval is exactly the same as a self referencing campaign. It is useful to do self referencing first to ensure the data is being retrieved correctly.
JavaScript_Self-Referencing_Campaigns
Once the data is retrieved with two small changes, the retrieved data can be inserted into the desired fields.
Examining the self referencing function
/*--------------------------------------
// The Self Referencing Lookup settings
--------------------------------------*/
function fn_SelfReferencing() {
if (typeof aryAjax_Settings=="undefined")
alert("Library did not load");
else {
var strValue = document.getElementById('Some_Field_In_Script').value;
aryAjax_Settings[0] = "client_demo"; //The system to use
aryAjax_Settings[1] = "automatic"; //The automation username
aryAjax_Settings[2] = "passkey"; //The automation users password
aryAjax_Settings[3] = "1"; //The Id of the campaign
aryAjax_Settings[4] = "strCDA_1_field_0_0"; //The search field
aryAjax_Settings[5] = strValue; //The search value
aryAjax_Settings[13] = "-1"; //Id of the current record, used for delimiting and not repeating current case
aryAjax_Settings[14] = "true"; //Click through to campaign?
aryAjax_Settings[15] = "divWarning"; //The id of the destination to which the table will be inserted
aryAjax_Settings[16] = "Insert"; //The types of processing. Table or Insert
//The fields to be returned into the array
//The column names of those fields
//The first field must always be the ID of the campaign
aryAjax_Settings[6] = "strCDA_1_field_0_0,strCDA_1_field_0_1";
aryAjax_Settings[12] = "Field 1,Field 2";
aryAjax_Settings[17] = "strCDA_2_field_0_24,strCDA_2_field_0_25";
fn_Ajax_BE_Process();
}
}Changes are required to line 19 and line 26.
Line 19, needs to have the key word "Insert" instead of "Table"
Line 26, is the list of fields in the current campaign, into which the data will be inserted. The fields in line 24 will be loaded into the corresponding fields in line 26. i.e. in the demo above strCDA_1_field_0_0 will be loaded into strCDA_2_field_0_24
Whilst testing it is useful to change back to the "Table" setup to ensure the correct data is being retrieved.