
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not Joining Values
Hi,
I have a script that has a loop that checks for a value in a field. When it finds it it should add a flag to it in Field called flag with number 1, but it doesnt do it, i am not sure why.
My Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The join does not produce records because your loop contains other fields than the join

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Nolgath You are connecting to data connection below but you are not using that anywhere in your loop. Then what is the use of calling that connection string?
LIB CONNECT TO 'SMTP - BREVO (cars2clickvm_radu.chitu)';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The LIB CONNECT TO 'SMTP - BREVO (cars2clickvm_radu.chitu)'; is a connection to a REST API, for the email sending.
I use in the loop my table "Requests_triggers"
The goal is to run the loop through the table Requests_triggers finding the value "Answered" inside the field "request_status"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Nolgath It seems you are complicating it through for loop which is not needed that's what I think. You can create the Flag just with if condition in your data.
Requests_triggers:
LOAD *,
if(request_status='Answered',1) as Flag
FROM [lib://FORMS_DATA (cars2clickvm_radu.chitu)/Deal Monitor Outputs/Deal_Monitor_BM_FINAL.qvd] (qvd);
Store Requests_triggers into [lib://FORMS_DATA (cars2clickvm_radu.chitu)/Request_Flags.qvd] (qvd);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That will not work because when it goes through the loop to send emails per each row, it will ignore those from the start, they need to pass throught the loop, send the emails, flag them so on the next reload of the app those emails already sent will not be sent again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Nolgath did you check my previous comment?
Change the field names in the For loop to key_temp and Flag_temp

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Nolgath try to change your code as below
TempTable_Request_Status:
Load 0 as Junk
AutoGenerate 0;
// Loop through the Requests_triggers
For i = 0 to NoOfRows('Requests_triggers') - 1
LET vRequest_Status = Peek('request_status', $(i), 'Requests_triggers');
LET vkey = Peek('key', $(i), 'Requests_triggers');
IF '$(vRequest_Status)' = 'Answered' THEN
Concatenate(TempTable_Request_Status)
Load
'$(vkey)' as key,
1 as Flag
AutoGenerate 1;
TRACE -----------------------;
TRACE -- vkey: $(vkey) --;
TRACE -----------------------;
END IF;
NEXT;
Left Join (Requests_triggers)
Load key,
Flag
Resident TempTable_Request_Status;
// Drop TempTable
DROP TABLE TempTable_Request_Status;
