Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

sqlGetInt queryDef Equivalent

Avatar

Avatar
Validate 1
Level 1
JamesAlio
Level 1

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
JamesAlio
Level 1

Likes

0 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
JamesAlio
Level 1

24-03-2021

Hello,

im using this native query and it works fine but i want to know how i can do the Something using queryDef.

this is my native SQL: 

 

 

  var email = NLWS.xtkSession.FormatDataPolicy("lowerCase", email.trim());
  var firstName = NLWS.xtkSession.FormatDataPolicy("lowerCase", firstName);
  var lastName = NLWS.xtkSession.FormatDataPolicy("lowerCase", lastName);

var sql ="SELECT R0.iRecipientId FROM NmsRecipient R0 JOIN XtkFolder F1 ON (F1.iFolderId = R0.iFolderId) WHERE LOWER(R0.sFirstName)='"+firstName+"' AND LOWER(R0.sLastName)='"+lastName+"' AND LOWER(R0.sEmail)='"+email+"' AND F1.sName IN('folder_2','folder_1')";

var idRecipient = sqlGetInt(sql);

 

 

Thnaks in advance.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

960 likes

Total Posts

1,087 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

960 likes

Total Posts

1,087 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

24-03-2021

Hi,

 

var recipientId = xtk.queryDef.create(
    <queryDef schema="nms:recipient" operation="getIfExists">
      <select>
      <node expr="@id" />
    </select>
    <where>
      <condition expr={"lower(@email) = '" + NLWS.xtkSession.FormatDataPolicy('lowerCase', email.trim()) + "'"}/>
      <condition expr={"lower(@firstName) = '" + NLWS.xtkSession.FormatDataPolicy('lowerCase', firstName) + "'"}/>
      <condition expr={"lower(@lastName) = '" + NLWS.xtkSession.FormatDataPolicy('lowerCase', lastName) + "'"}/>
      <condition expr="[folder/@name] IN ('folder_2', 'folder_1')"/>
    </where>
  </queryDef>
).ExecuteQuery().@id;

 

Thanks,

-Jon

Answers (0)