Link to home
Start Free TrialLog in
Avatar of tf2012
tf2012

asked on

a general code/script question

I'm  working on a project that happens to be using AMPScript in ExactTarget / SalesForce.

The project involves getting a bunch (about 65 values) from various columns in a table (in their lingo a "data extension") and displaying the values in the html body of a email (basically an html page).  This is done using AMPScript which is their in house scripting language for doing this kind of stuff.  It's all done within the document body and there are no external include files etc.  So with about 65 values should I make a block at the top of the document assigning each value or should I just assign the value inline in each instance.  It's on a cloud service and I don't expect any performance constraints with using variables.

For example:

<doc start>
var thing1 = go get the value from the data extension;
var thing2 = go get the value from the data extension;
var thing3= go get the value from the data extension;
var thing4 = go get the value from the data extension;
var thing5 = go get the value from the data extension;
etc etc etc 65 times

Here is the value of thing1= %%thing1%%

Here is the value of thing2= %%thing2%%

Here is the value of thing3= %%thing3%%


OR shoud I use this approach?

Here is the value of thing1= %%go get the value from the data extension;%%

Here is the value of thing2= %%go get the value from the data extension;%%

Here is the value of thing3= %%go get the value from the data extension;%%
etc etc 65 times

I would say the first approach is cleaner and more professional but in the real world which is the best practice?
Avatar of ozo
ozo
Flag of United States of America image

If your in house scripting language  supports any kind of arrays or loops, I would not want to write essentially the same code 65 times.
Avatar of tf2012
tf2012

ASKER

Good point, but the variable names do differ quite a bit, there isn't any real pattern in the variable names that would support the use of a loop unfortunately.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tf2012

ASKER

Great thank you for the insight!
seems to double the opportunities to make a mistake
That's why I also wrote the second sentence!