Expand my Community achievements bar.

How to loop through all the nodes which are in map entry

Avatar

Level 3

Hi ,

I have a form which will allow the users to search for the titles of DVD's/Blue Ray DVD's by giving the Title name (Or it could be combination of 3 letters not less that that).If it finds it will show the multiple records in a list box .Upon selecting the record/product the related data regarding the product will be displayed in the table.Table contains  6 to 7 columns in which we have a one column is date field which will show the product release date.

The title product details or coming from the short lived process which internally makes web Service call.Input of the Process is the  Title name (Or it could be combination of 3 letters not less that that) and country name. and output is map of string.

Now i want to add a condition that i have to take the street data from the each entry of a map .and have to compare that withe the current date.If the Street date is >= Current date(November 4 2014 is greater than August 27th 2014) then those record need not to display in the list box.

I Hope i have explained clearly .Please help me How i can do that?

Thanks ,

Bharathi.

1 Reply

Avatar

Level 3

Hi I have written this logic on execute script picker at the end of the process so the the updated map will be given to from.

import java.util.map;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

Map<String >  reportedmap =patExecContext.getProcessDataMapValue(" /process_data/outTitleSearchInfo ") ;

  1. System.out.println("reportingMap  : " + reportedmap);

if( ! reportingmap.isEmpty()) {

do {

String catalog =  (String) reportingmap.get(3);

String streetDate =  (String) reportingmap.get(7); // where the street value is store in the entry of map

System.out.println(streetDate);

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

Date date = new Date();

Date date1 = sdf.parse(steetDate);

Date date2 = sdf.parse(date);

System.out.println(sdf.format(date1));

System.out.println(sdf.format(date2));

if(date1.after(date2))

{

reportmap.remove(catalog);

}

}while(reportedmap.hasNext());

}

patExecContext.setProcessDataMapValue(" /process_data/outTitleSearchInfo ", reportmap);

But this is not  executing .Let me know where i am going wrong.

Thanks ,

Bharathi.