Find from a binary code, e.g. 127 the code as single decimal additors and as binary number.
Put in the given number, e.g. as paramter in field "wert".
In 2D-window you will find the following result:
127
1, 2, 4, 8, 16, 32, 64
1111111
the first line is the given number (e.g. a masking value)
the second line gives back the single additors
the third line gives back the binary code 0 or 1
First you need 2 new parameters:
"wert" as integer
and "art" as string
!2D-Script
DIM xi[],xe[] ,fak[], str_i[] xi[1]=wert n=1 REPEAT n=n+1 xi[n] = xi[n-1]/2 xe[n] = FRA(xi[n]) xi[n] = INT(xi[n]) IF xe[n]#0 THEN fak[n]=1 ! TEXT2 0,n,xi[n] ! TEXT2 1,n+0.5,fak[n] UNTIL xi[n]<1 zahl="" FOR i=2 TO n zahl=zahl+STR(xe[i],1,0) NEXT i TEXT2 0,1,wert TEXT2 0,-1,zahl anzahl = STRLEN(zahl) dert="" zu=1 FOR i=1 TO anzahl str_i[i]=STRSUB(zahl,i,1) IF str_i[i]="1" THEN IF i<anzahl THEN dert=dert+str(zu,1,0)+", " IF i=anzahl THEN dert=dert+str(zu,1,0) ENDIF IF art="Reihenfolge" THEN zu=zu+1 IF art="Werte" THEN zu=zu*2 NEXT i TEXT2 0,0,dert
!Parameter-Script
VALUES "art" "Reihenfolge","Werte"