4 Replies Latest reply: Jan 17, 2013 5:54 PM by Ralf Becher

# Create a flag

Hi,

I have tried in different ways but not with good result. Therefore I turn to the combined wisdom of community...

I have a table with visitors:

Visitors:
Left(Filename(), 3) as Omr,
(Filename()) as Reg,
RecNo() as %Index,
Patindex,
Left(FileName(), 3) & '_' & Patindex as %IndexPnr,
Left(FileName(), 3) & '_' & Patindex as %IndexPnrTest,
VisitingDate,
Left(FileName(), 3) & '_' & Patindex & '_' & VisitingDate as %IndexPnrBD,
Year(MakeDate(Left(Besöksdatum, 4), Mid(VisitingDate, 5, 2), Mid(VisitingDate, 7, 2))) as År,
Month(MakeDate(Left(Besöksdatum, 4), Mid(VisitingDate, 5, 2), Mid(VisitingDate, 7, 2))) as Månad,
Day(MakeDate(Left(Besöksdatum, 4), Mid(VisitingDate, 5, 2), Mid(VisitingDate, 7, 2))) as Dag,
WeekDay(MakeDate(Left(Besöksdatum, 4),          Mid(VisitingDate, 5, 2), Mid(VisitingDate, 7, 2))) as VeckoDag,
If(Day(MakeDate(Left(Besöksdatum, 4), Mid(VisitingDate, 5, 2), Mid(VisitingDate, 7, 2))) = 25, 'Journal per 25:e') as Info,
Signatur,
Journal  as VG,

%Index is unique for every visitor. But every visitor can appear multiple time in table. What's the best way to create a flag to be able to sum every unique visit with the same result as Count(DISTINCT %Index)?

Best regards

Torbjörn Ungvall (@Ungvall)

Senior Business Discovery Manager

• ###### Re: Create a flag

Hi Torbjörn,

could you give an example: Input (maybe a bit simplified) and expected output?

Ciao

Klaus

• ###### Re: Create a flag

Thanks,

Uploaded a scrambled file. Sum(Flag) have to be same as Count(DISTINCT %Index)

Best regards

Torbjörn Ungvall (@Ungvall)

Senior Business Discovery Manager