Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why this query doesn't return all Queue records?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01078686
Message ID:
01078738
Vues:
10
>>Sergey,
>>
>>The query now works great. But I want to be able to cross tab it, e.g.
>>
>>Queue Name        I      H      M     O
>>UNASSIGNED        0      0      0     1000
>>CORRECTION        0      0      0     2000
>>BILLER            0      0      0     10
>>
>>where I, H, M and O are departments. However, here is a little problem. Our Queue Names table has only certain departments. I'd like to show all departments as my field names. I ran FastXTab against the resulting cursor and get the result I showed [except for the little problem with O department that was replaced with _]. What would be the easiest way to add other departments to the resulting cursor?
>
>If you don't have long fields, you can use ALTER TABLE.

You're right, I haven't realized it. I can have a second step to get all records from departments table which are not in my result and then after I get resulting cursor from FastXTab apply ALTER TABLE command. The value would be 0 by default.

E.g. here is what I have now and it would be easy to modify:
FUNCTION GetQueuesDistribution
LPARAMETERS tcAlias
IF EMPTY(m.tcAlias)
   tcAlias = "c_AccountsByQueues"
ENDIF
   
LOCAL lcSQL
TEXT TO lcSQL NOSHOW PRETEXT 7	
	SELECT Queue_Names.cQueue_Name, 
	nvl(Trans.cDepartment_Code, Queue_Names.cDepartment_Code) as cDepartment_Code, 
	CAST(NVL(COUNT(Trans.cTrans_pk), 0) as Numeric(5,0)) as nCount 
	FROM Queue_Names
	LEFT JOIN Trans_Employees_Queues on 
	Queue_Names.cQueue_Names_pk = Trans_Employees_Queues.cQueue_Names_fk 
	AND Trans_Employees_Queues.iActive_Flag = 1 
	LEFT JOIN Trans on Trans.cTrans_pk = Trans_Employees_Queues.cTrans_fk	
	where Queue_Names.iActive_Flag = 1
	group by 1, 2
ENDTEXT
RunSQL(m.lcSQL, m.tcAlias)
browse
oXtab = NewObject("FastXtab", "FastXtab.prg")
oXtab.lCursorOnly = .T.
oXtab.lBrowseAfter = .T.
oXtab.RunXtab()
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