TAG([CDXFileName,] nTagNumber [, nWorkArea | cTableAlias])There are a lot of optional parameters there, and I opted out of the wrong one! I just chose to specify the CDX, and leave the alias off as 'optional'. I guess if I don't specify the alias, when I try to insert it into the cursor, at the moment it tries to evaluate what alias TAG() is referring to, my 'cAliasName' cursor must no longer be selected, so no text is returned? That would at least make sense then why in your version of the TAG function call, the alias is specified to overcome this & it works!
> INSERT INTO orderList( cTagName, tagExpression ) VALUES ; > (TAG("", nTagCount, cAliasName), KEY("", nTagCount, cAliasName)) >>
? TAG(cAliasName, nTagCount)
as a debugging measure to try to figure out why my cTagName field was coming up empty everytime I ran this code. To my surprise, I was getting the TAG names written out to my VFP screen, but I still was getting nothing inserted into my table. Notice I'm trimming the value that I'm inserting, and none of the tag names are greater than the 50 character field width.>>LPARAMETERS cAliasName >>LOCAL nTagCount >> >>nTagCount = 1 >> >>CREATE CURSOR orderList ( cTagName C(50), tagExpression C(200) ) >> >>if TAGCOUNT(cAliasName) > 0 >> for nTagCount = 1 to TAGCOUNT(cAliasName) >> ? TAG(cAliasName, nTagCount) >> INSERT INTO orderList( cTagName, tagExpression ) VALUES ; >> (alltrim(TAG(cAliasName, nTagCount)), SYS(14, nTagCount, cAliasName)) >> endfor >>endif >>>>