Go Back
2 Votes

Allow Mixed Case with genxml


We would like some way to have mixed case variables be part of a structure which is included in xfServerPlus situations.  That way, when someone is looking in CS, they can see the name as it is intended.  For example, if you have a field called PURCHASEORDERNUMBER, it becomes Purchaseordernumber.  We would like some way to tell genxml to make this PurchaseOrderNumber.
 

3 Comments | Posted by Gary Hoffmann to xfServerPlus, Repository on 9/19/2022 6:02 PM
Steve Ives
Hi Gary,

How would genxml know where to apply word breaks in a string like PURCHASEORDERNUMBER? What you are seeing is what we refer to as "xf case", which essentially means uppercasing the first character, lowercasing remaining characters, and maintaining underscore characters (not relevant in your example).

The closest you can get with genxml would be to add underscores between the words (i.e. changing the field name to PURCHASE_ORDER_NUMBER), you would wind up with a property named Purchase_order_number.

Beyond that, you would need to resort to using CodeGen and developing custom templates to produce your xfNetLink client classes instead of genxml and gencs. If you were to do that, and change the names to use underscores to break words, then you could achieve exactly what you are asking for.
 

9/21/2022 3:06 AM   0  
Gary Hoffmann
The easiest way I could see doing this is to allow mixed case in Alternate field name.  That would allow us to specify a mixed case variant in that name and use that one instead of the primary field. Or, if changing Alternate Field Name isn't possible, maybe adding an XML Field Name to the repository would work.

The other option is to make genxml smarter like CodeGen and to upcase the character following an underscore and remove the underscore, effectively making PURCHASE_ORDER_NUMBER into PurchaseOrderNumber, again, much like CodeGen does. 

Since we use DBL2XML to create the xml files, and CodeGen doesn't support that (at least not that I'm aware of), it would be next to impossible to use CodeGen for this.
 

9/21/2022 11:36 AM   0  
Steve Ives
You can already use the alternate field name to add underscores, see the genxml -n command line option, but that's going to give you "xf case," i.e. Customer_number. I agree that it would be nice to have camel case or pascal case options, but I wouldn't suggest holding your breath waiting for that :) 

9/24/2022 2:15 AM   0  
Please log in to comment on this idea.