У меня есть приведенный ниже AMPscript, который выдает эту ошибку:

Существует несколько логических условий для сценария IF/ELSEIF, но отсутствует требуемый логический оператор AND или OR, соединяющий вторичное условие. Сценарий: (@Variable_Scholarship_Name__c) != "" AND (@Raise_Late_Communication__c) == "S"

Я в тупике.

%%[
SET @rows = LookupRows("Contact_Salesforce","Id", _subscriberkey)
SET @Variable_Scholarship_Name__c = ""
SET @Variable_Scholarship_Amount__c = ""
SET @Raise_Late_Communication__c =""

if rowcount(@rows) > 1 then 

SET @row = row(@rows,1)
SET @Variable_Scholarship_Name__c = field(@row,"Variable_Scholarship_Name__c")
SET @Variable_Scholarship_Amount__c = field(@row,"Variable_Scholarship_Amount__c")
SET @Raise_Late_Communication__c = field(@row,"Raise_Late_Communication__c")

endif

IF (@Variable_Scholarship_Name__c) != "" AND (@Raise_Late_Communication__c) == "S" THEN
 You have qualified for the following scholarships:

Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
Scholarship Amount: $%%=v(FormatNumber(@Variable_Scholarship_Amount__c,"#,###"))=%%
Scholarship Title: Scholarship
Scholarship Amount: $

ELSEIF

 (@Variable_Scholarship_Name__c) == "" AND (@Raise_Late_Communication__c) == "S" THEN

You have qualified for the following scholarship:

Scholarship Title: Scholarship
Scholarship Amount: $

ELSEIF

 (@Variable_Scholarship_Name__c) != "" AND (@Raise_Late_Communication__c) != "S" THEN

You have qualified for the following scholarship:

Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
Scholarship Amount: $%%=v(FormatNumber(@Variable_Scholarship_Amount__c,"#,###"))=%%
ELSEIF
(@Variable_Scholarship_Name__c) == "" AND (@Raise_Late_Communication__c) != "S" THEN

ENDIF]%%
0
Adam Spriggs 3 Апр 2020 в 21:18

1 ответ

Лучший ответ

Вам нужно будет останавливать и запускать блоки AMPscript, если вы собираетесь выводить HTML и встроенный AMPscript.

Вы также можете использовать пустой (с/без не оператор) в ваших условных выражениях. Это немного короче.

%%[

    SET @rows = LookupRows("Contact_Salesforce","Id", _subscriberkey)
    SET @Variable_Scholarship_Name__c = ""
    SET @Variable_Scholarship_Amount__c = ""
    SET @Raise_Late_Communication__c =""

    if rowcount(@rows) > 1 then 

        SET @row = row(@rows,1)
        SET @Variable_Scholarship_Name__c = field(@row,"Variable_Scholarship_Name__c")
        SET @Variable_Scholarship_Amount__c = field(@row,"Variable_Scholarship_Amount__c")
        SET @Raise_Late_Communication__c = field(@row,"Raise_Late_Communication__c")

    endif

]%%

%%[ IF not empty(@Variable_Scholarship_Name__c) AND @Raise_Late_Communication__c == "S" THEN ]%%

    You have qualified for the following scholarships:
    Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
    Scholarship Amount: $%%=FormatNumber(@Variable_Scholarship_Amount__c,"#,###")=%%
    Scholarship Title: Scholarship
    Scholarship Amount: $

%%[ ELSEIF empty(@Variable_Scholarship_Name__c) AND @Raise_Late_Communication__c == "S" THEN ]%%

    You have qualified for the following scholarship:

    Scholarship Title: Scholarship
    Scholarship Amount: $

%%[ ELSEIF not empty(@Variable_Scholarship_Name__c) AND @Raise_Late_Communication__c != "S" THEN ]%%

    You have qualified for the following scholarship:

    Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
    Scholarship Amount: $%%=FormatNumber(@Variable_Scholarship_Amount__c,"#,###")=%%

%%[ ELSEIF empty(@Variable_Scholarship_Name__c) AND @Raise_Late_Communication__c != "S" THEN ]%%


%%[ ENDIF ]%%
5
Adam Spriggs 3 Апр 2020 в 21:15