Concat Loop Results to determine if contains valueAMPScript - Only Show RSS Items from Last 14 DaysPulling two column values in single row if either 1 of 2 other columns in that row are trueUsing an AMPscript loop to build a concat functionAMPScript, Checking values in a rowHow to update checkbox bases on values childobjectOne template with different sendable Data ExtensionsCannot submit form on custom Preference CenterUse lookup value within concat functionAmpscript FOR Loops results to retrieve product using a second Loop
Using hearing aids on the sabbath?
What is the difference between 王 and 皇?
Why is there a large performance impact when looping over an array over 240 elements?
Markov-chain sentence generator in Python
How would timezones work on a planet 100 times the size of our Earth
If I animate and control a zombie, does it benefit from Undead Fortitude when it's reduced to 0 HP?
Is there a way to count the number of lines of text in a file including non-delimited ones?
Why is the Lucas test not recommended to differentiate higher alcohols?
How far did Gandalf and the Balrog drop from the bridge in Moria?
Why are Tucker and Malcolm not dead?
(A room / an office) where an artist works
What is the farthest a camera can see?
What is a good class if we remove subclasses?
Does Nightpack Ambusher's second ability trigger if I cast spells during the end step?
Boss asked a co-worker to assault me
Graphs for which a calculus student can reasonably compute the arclength
Is there any way to stop a user from creating executables and running them?
How is являться different from есть and быть
Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?
How much can I judge a company based on a phone screening?
Do I have to cite common CS algorithms?
An equality about sin function?
Can I enter the USA with an E-2 visa and a one way flight ticket?
Boss wants me to ignore a software API license prohibiting mass download
Concat Loop Results to determine if contains value
AMPScript - Only Show RSS Items from Last 14 DaysPulling two column values in single row if either 1 of 2 other columns in that row are trueUsing an AMPscript loop to build a concat functionAMPScript, Checking values in a rowHow to update checkbox bases on values childobjectOne template with different sendable Data ExtensionsCannot submit form on custom Preference CenterUse lookup value within concat functionAmpscript FOR Loops results to retrieve product using a second Loop
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the following code to retrieve the series of a product that has been purchased. We are using a loop because a contact might purchase multiple products.
%%[IF NOT EMPTY(@PersonAccountId)
THEN set @MyWatchesTable = RetrieveSalesforceObjects("My_Watches__c","Product__c","Person_Account__c", "=", @PersonAccountId,"Status__c","=", "Owner")
SET @rowCount = RowCount(@MyWatchesTable)
IF @rowCount > 0 THEN
FOR @counter = 1 to @rowCount DO
SET @MyWatchesRow = Row(@MyWatchesTable, @counter)
SET @Product = Field(@MyWatchesRow,"Product__c")
SET @ProductTable = RetrieveSalesforceObjects("Product2","Series__c","Id", "=", @Product)
set @productCount = RowCount(@ProductTable)
set @ProductRow = Row(@ProductTable, @productCount)
set @Series = Field(@ProductRow, "Series__c")
]%%
-->
Product %%=v(@counter)=%% : %%=v(@Product)=%%<br>
Series %%=v(@productCount)=%% : %%=v(@Series)=%% <br>
%%[ next @counter ]%% %%[ else ]%% No records found %%[ endif ]%%
<!-- %%[ENDIF]%%-->
I need to use the results of the loop to select the corresponding product checkbox if they own the product.
I wanted to concatenate the loop results
set @OutPutSeries = Concat(@counter, " ", @Product, " ", @productCount, " ", @Series, " ", next @counter)
and then use the the IndexOf to determine if the concatenated result contains one of the products
/* Does it match; ; if no match, output of IndexOf(1,2) will be "0" */
if IndexOf(@Series,'Connected') > 0 then
Set @OutputSoldConnected = "True"
else
Set @OutputSoldConnected = "False"
endif
Then use the True/False result to prepopulate the checkbox
I have tried to use the indexOf on the @Series variable but it only returns the last result, that is why I thought about concatenating them but it did not work.
marketing-cloud ampscript loop
add a comment |
I have the following code to retrieve the series of a product that has been purchased. We are using a loop because a contact might purchase multiple products.
%%[IF NOT EMPTY(@PersonAccountId)
THEN set @MyWatchesTable = RetrieveSalesforceObjects("My_Watches__c","Product__c","Person_Account__c", "=", @PersonAccountId,"Status__c","=", "Owner")
SET @rowCount = RowCount(@MyWatchesTable)
IF @rowCount > 0 THEN
FOR @counter = 1 to @rowCount DO
SET @MyWatchesRow = Row(@MyWatchesTable, @counter)
SET @Product = Field(@MyWatchesRow,"Product__c")
SET @ProductTable = RetrieveSalesforceObjects("Product2","Series__c","Id", "=", @Product)
set @productCount = RowCount(@ProductTable)
set @ProductRow = Row(@ProductTable, @productCount)
set @Series = Field(@ProductRow, "Series__c")
]%%
-->
Product %%=v(@counter)=%% : %%=v(@Product)=%%<br>
Series %%=v(@productCount)=%% : %%=v(@Series)=%% <br>
%%[ next @counter ]%% %%[ else ]%% No records found %%[ endif ]%%
<!-- %%[ENDIF]%%-->
I need to use the results of the loop to select the corresponding product checkbox if they own the product.
I wanted to concatenate the loop results
set @OutPutSeries = Concat(@counter, " ", @Product, " ", @productCount, " ", @Series, " ", next @counter)
and then use the the IndexOf to determine if the concatenated result contains one of the products
/* Does it match; ; if no match, output of IndexOf(1,2) will be "0" */
if IndexOf(@Series,'Connected') > 0 then
Set @OutputSoldConnected = "True"
else
Set @OutputSoldConnected = "False"
endif
Then use the True/False result to prepopulate the checkbox
I have tried to use the indexOf on the @Series variable but it only returns the last result, that is why I thought about concatenating them but it did not work.
marketing-cloud ampscript loop
add a comment |
I have the following code to retrieve the series of a product that has been purchased. We are using a loop because a contact might purchase multiple products.
%%[IF NOT EMPTY(@PersonAccountId)
THEN set @MyWatchesTable = RetrieveSalesforceObjects("My_Watches__c","Product__c","Person_Account__c", "=", @PersonAccountId,"Status__c","=", "Owner")
SET @rowCount = RowCount(@MyWatchesTable)
IF @rowCount > 0 THEN
FOR @counter = 1 to @rowCount DO
SET @MyWatchesRow = Row(@MyWatchesTable, @counter)
SET @Product = Field(@MyWatchesRow,"Product__c")
SET @ProductTable = RetrieveSalesforceObjects("Product2","Series__c","Id", "=", @Product)
set @productCount = RowCount(@ProductTable)
set @ProductRow = Row(@ProductTable, @productCount)
set @Series = Field(@ProductRow, "Series__c")
]%%
-->
Product %%=v(@counter)=%% : %%=v(@Product)=%%<br>
Series %%=v(@productCount)=%% : %%=v(@Series)=%% <br>
%%[ next @counter ]%% %%[ else ]%% No records found %%[ endif ]%%
<!-- %%[ENDIF]%%-->
I need to use the results of the loop to select the corresponding product checkbox if they own the product.
I wanted to concatenate the loop results
set @OutPutSeries = Concat(@counter, " ", @Product, " ", @productCount, " ", @Series, " ", next @counter)
and then use the the IndexOf to determine if the concatenated result contains one of the products
/* Does it match; ; if no match, output of IndexOf(1,2) will be "0" */
if IndexOf(@Series,'Connected') > 0 then
Set @OutputSoldConnected = "True"
else
Set @OutputSoldConnected = "False"
endif
Then use the True/False result to prepopulate the checkbox
I have tried to use the indexOf on the @Series variable but it only returns the last result, that is why I thought about concatenating them but it did not work.
marketing-cloud ampscript loop
I have the following code to retrieve the series of a product that has been purchased. We are using a loop because a contact might purchase multiple products.
%%[IF NOT EMPTY(@PersonAccountId)
THEN set @MyWatchesTable = RetrieveSalesforceObjects("My_Watches__c","Product__c","Person_Account__c", "=", @PersonAccountId,"Status__c","=", "Owner")
SET @rowCount = RowCount(@MyWatchesTable)
IF @rowCount > 0 THEN
FOR @counter = 1 to @rowCount DO
SET @MyWatchesRow = Row(@MyWatchesTable, @counter)
SET @Product = Field(@MyWatchesRow,"Product__c")
SET @ProductTable = RetrieveSalesforceObjects("Product2","Series__c","Id", "=", @Product)
set @productCount = RowCount(@ProductTable)
set @ProductRow = Row(@ProductTable, @productCount)
set @Series = Field(@ProductRow, "Series__c")
]%%
-->
Product %%=v(@counter)=%% : %%=v(@Product)=%%<br>
Series %%=v(@productCount)=%% : %%=v(@Series)=%% <br>
%%[ next @counter ]%% %%[ else ]%% No records found %%[ endif ]%%
<!-- %%[ENDIF]%%-->
I need to use the results of the loop to select the corresponding product checkbox if they own the product.
I wanted to concatenate the loop results
set @OutPutSeries = Concat(@counter, " ", @Product, " ", @productCount, " ", @Series, " ", next @counter)
and then use the the IndexOf to determine if the concatenated result contains one of the products
/* Does it match; ; if no match, output of IndexOf(1,2) will be "0" */
if IndexOf(@Series,'Connected') > 0 then
Set @OutputSoldConnected = "True"
else
Set @OutputSoldConnected = "False"
endif
Then use the True/False result to prepopulate the checkbox
I have tried to use the indexOf on the @Series variable but it only returns the last result, that is why I thought about concatenating them but it did not work.
marketing-cloud ampscript loop
marketing-cloud ampscript loop
asked 10 hours ago
SYUYDYSYUYDY
806 bronze badges
806 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you need to append values to a variable from within a loop, you'll need to remember to include the variable itself during concatenation. Otherwise, you'll simply be "re-setting" the variable after each iteration (i.e., the variable will be set according to the last iteration, only).
For example, this yields only the last result:
%%[
for @counter = 1 to 3 do
set @series = Concat(@counter, " ")
next @counter
]%%
%%=V(@series)=%%
Output:
3
This, on the other hand, will yield all concatenated values:
%%[
set @series = "" /* initialize outside of loop */
for @counter = 1 to 3 do
set @series = Concat(@series, @counter, " ") /* include existing value first */
next @counter
]%%
%%=V(@series)=%%
Output:
1 2 3
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f273483%2fconcat-loop-results-to-determine-if-contains-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you need to append values to a variable from within a loop, you'll need to remember to include the variable itself during concatenation. Otherwise, you'll simply be "re-setting" the variable after each iteration (i.e., the variable will be set according to the last iteration, only).
For example, this yields only the last result:
%%[
for @counter = 1 to 3 do
set @series = Concat(@counter, " ")
next @counter
]%%
%%=V(@series)=%%
Output:
3
This, on the other hand, will yield all concatenated values:
%%[
set @series = "" /* initialize outside of loop */
for @counter = 1 to 3 do
set @series = Concat(@series, @counter, " ") /* include existing value first */
next @counter
]%%
%%=V(@series)=%%
Output:
1 2 3
add a comment |
If you need to append values to a variable from within a loop, you'll need to remember to include the variable itself during concatenation. Otherwise, you'll simply be "re-setting" the variable after each iteration (i.e., the variable will be set according to the last iteration, only).
For example, this yields only the last result:
%%[
for @counter = 1 to 3 do
set @series = Concat(@counter, " ")
next @counter
]%%
%%=V(@series)=%%
Output:
3
This, on the other hand, will yield all concatenated values:
%%[
set @series = "" /* initialize outside of loop */
for @counter = 1 to 3 do
set @series = Concat(@series, @counter, " ") /* include existing value first */
next @counter
]%%
%%=V(@series)=%%
Output:
1 2 3
add a comment |
If you need to append values to a variable from within a loop, you'll need to remember to include the variable itself during concatenation. Otherwise, you'll simply be "re-setting" the variable after each iteration (i.e., the variable will be set according to the last iteration, only).
For example, this yields only the last result:
%%[
for @counter = 1 to 3 do
set @series = Concat(@counter, " ")
next @counter
]%%
%%=V(@series)=%%
Output:
3
This, on the other hand, will yield all concatenated values:
%%[
set @series = "" /* initialize outside of loop */
for @counter = 1 to 3 do
set @series = Concat(@series, @counter, " ") /* include existing value first */
next @counter
]%%
%%=V(@series)=%%
Output:
1 2 3
If you need to append values to a variable from within a loop, you'll need to remember to include the variable itself during concatenation. Otherwise, you'll simply be "re-setting" the variable after each iteration (i.e., the variable will be set according to the last iteration, only).
For example, this yields only the last result:
%%[
for @counter = 1 to 3 do
set @series = Concat(@counter, " ")
next @counter
]%%
%%=V(@series)=%%
Output:
3
This, on the other hand, will yield all concatenated values:
%%[
set @series = "" /* initialize outside of loop */
for @counter = 1 to 3 do
set @series = Concat(@series, @counter, " ") /* include existing value first */
next @counter
]%%
%%=V(@series)=%%
Output:
1 2 3
answered 9 hours ago
Mark GMark G
1,1371 gold badge2 silver badges11 bronze badges
1,1371 gold badge2 silver badges11 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f273483%2fconcat-loop-results-to-determine-if-contains-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown