Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ABS() coding assistance???
Message
 
 
À
24/08/2001 12:20:28
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00548379
Message ID:
00548766
Vues:
7
>>>
select distinct your_field from your_table into array diffval
>>>for i=1 to alen(diffval)
>>>   nValue=diffval[i]
>>>   nColor=this.mycolor(nValue)
>>>   replace (colorfield) with nColor for your_field=nValue
>>>endfor
>>>this.grid1.column1.dynamicforecolor='your_table.colorfield'
>>>
>>>You should run this in grid's init or form's load. Not sure about the sparse setting; in the case which initiated this thread, I tried with an additional column which contained the input mask, set the dynamicinputmask to the name of that field, and it worked with sparse=.f., otherwise it changed inputmasks as you moved up and down.
>>
>>Hi Dragan,
>>
>>I added a new field in my addition lookup table AddrStat custColor. I made it integer and put 0, 255, etc. colors respectively (this table has only 8 records). In my main form I set relation to this table based on the status field. In the grid I added this.setall('DynamicForeColor','AddrStat.CustColor') and it worked like a charm!!!!!
>
>So you've extended it a little and took a color source from another table... I'd really like to know how does it work (speed-wise) on a large table (and I remember you have lots of those), and what happens if you change the foreign key for a record, how fast does it change color in that case.
>
>I knew the trick was good - thanks for testing it :). It worked here, but I never really tried it on a big table, or to pull colorsource from a different table.

Well, in my quick tests it works great. Before running the process I save relation lcSaveRel=set('relation') set relation to, then set it back. When I change one record it works just fine. The main table has 6000 records and it related to 8 records. I've tried on another table with 20000 recs and it works too!

I'm going to use this technique since now on!
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform