Hello,
I am trying to create a unique ID using a specific Date format.
In my graph I use a reformat component.
In my reformat component I have some inputs 2 of them are:
- $in.0.Total → This is the total number of records that I am passing through.
- $in.0.ID → This record is null
What I did I created a While statement that I wanted to create a unique value in very spicific way and in that while loop to assign a each ID to the record.
The following is the while statement is what I used in the reformat:
integer i;
integer a;
integer b=getMillisecond(today(),“GMT”);
integer c = $in.0.Total;
while (i != c) {
$out.0.ID =“”+ getYear(today(),“GMT”)+getMonth(today(),“GMT”)+getDay(today(),“GMT”)+getHour(today(),“GMT”)+getMinute(today(),“GMT”)+getSecond(today(),“GMT”)+b;
i++;
b++;
};
The logic into this is that I create an ID using the format (Year,Month,Day,Hour,Minutes,Seconds,Milliseconds)
I set a parameter b that is the Milliseond.
A parameter i that will start from - and go increment by 1 until I get all the values inserted into my IDs.
A parameter c that is equal into the number of records I have so I can run the while statement that many times.
My expectation is that if I had 20 records it will get the first id = 201931232756954 and then it will increment by 1 for all the other records.
My problem is that when I use this while statement is that is assigning the same value (first ID) into all the records.
How to change this transformation in order to make it work as I want?
I attached an example of my output.