Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I've a table with script as shown below
Table1:
Load *,
Time(Frac(Floor(DTField,1/24)),'hh') as Hour
From Table1;
FOR i=0 to 23
Concatenate(Table)
LOAD Time(MakeTime($(i)),'hh') as Hour AutoGenerate(1)
;
NEXT
- When i'm trying to concatenate the for loop with above table. It generates two values for the field Hour. i.e. 00,01,07,07,10,11,13,13
How can i overcome this?
Not sure what you want to achieve and what you get. Are you saying you don't get any Hour values 02, 03, 04 ,05, 06, etc., despite the FOR LOOP running over all hours?
I wouldn't think it's a bug if you get duplicate value for Hours, since you are first loading some hours from a table, then concatenating each single hour (for which you don't need a FOR LOOP, you can also use autogenerate 24 and recno() function).
Creating your Hour in the first table using Frac(floor(FIELD,1/24)) seems soemwhat problematic to me, if you want a possible match with values created by Maketime(). Consider using maketime(hour(FIELD)) instead in your first load.
Hope this helps,
Stefan
Hi
The first part of the load is making hours that are not exact hours as it does not remove the minute/second part of the time. The Hour keyword formats this to look the same, but does not change the underlying value.
Try this: Time(Int(Frac(DTField) * 24) / 24, 'hh')
Hope that helps
Jonathan
Ok leave this.. What i want is, Through this script Time(Frac(Floor(Pallet_DT,1/24)),'hh') as Hour. I can able to get the hours from my timestamp filed. But not all 24 hours values b'coz there is no values for all hours. I can see all the hours which are existing in the timestamp. But user needs to see entire 24 hours values. Right now it shows me
00,01,07,23.
But i need the full 24 hours in same field i.e. 00,01,02,03,04,05,.......21,22,23. So that user can choose his own hours.
Not sure what you want to achieve and what you get. Are you saying you don't get any Hour values 02, 03, 04 ,05, 06, etc., despite the FOR LOOP running over all hours?
I wouldn't think it's a bug if you get duplicate value for Hours, since you are first loading some hours from a table, then concatenating each single hour (for which you don't need a FOR LOOP, you can also use autogenerate 24 and recno() function).
Creating your Hour in the first table using Frac(floor(FIELD,1/24)) seems soemwhat problematic to me, if you want a possible match with values created by Maketime(). Consider using maketime(hour(FIELD)) instead in your first load.
Hope this helps,
Stefan
Hi,
If i use that script it shows me red error lines in the script. What i need to do?
Swuehl,
Please check the attached file. I don't need duplicate values.
Time(maketime(hour(Pallet_DT)),'hh') as Hour
script works perfectly.
Good to hear... or maybe just hour(Pallet_DT) as Hour (could also be formatted with two digits)?
No Swuehl, just hour(Pallet_DT) doesn't work b'coz different dates has same hours. If i use this code i didn't get unique hours. I don't want want duplicate values.