know an array
Posted:
Mon Jul 16, 2018 7:29 pm
by Silvio.Falconi
I have a dbf and save the records on a array with conditions saving only the number of invoice (n)
if I created an array type
AaDd(aSilvio, {n})
if I would like to know if a number (n) has been inserted into that array more than once, how should I know?
Re: know an array
Posted:
Tue Jul 17, 2018 10:30 am
by darioflores
Hello, you could try something like this:
- Code: Select all Expand view
nIterations := 0
nPos := aScan(aArray, {|x| x[1]==nFac})
do while nPos>0
nIterations++
nPos := aScan(aArray, {|x| x[1]==nFac}, nPos+1)
enddo
Re: know an array
Posted:
Tue Jul 17, 2018 11:28 am
by Silvio.Falconi
thanks
I wish search on rooms
the room number 13 have two bookings
I made
- Code: Select all Expand view
Function ControlloMulti(aMultiplePre,nNumero,nStatus,cGuest ,cTypeDay)
Local t
Local lReturn :=.f.
Local nTimes:= 0
Local nIterations:=0
Local nPos := aScan(aMultiplePre, {|x| x[1]==nNumero})
do while nPos>0
nIterations++
nPos := aScan(aMultiplePre, {|x| x[1]==nNumero}, nPos+1)
enddo
IF nIterations >1
AaDd(aPreMulti,{nNumero,nStatus,cGuest ,cTypeDay } )
lReturn :=.t.
endif
return lReturn
the problem is I see only one booking and not all for a room sample on room 13 I have two bookings but the function show me this