NetTalk Central

Author Topic: JFiles : some questions  (Read 2207 times)

AtoB

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
JFiles : some questions
« on: December 12, 2017, 05:52:09 AM »
Hi Bruce,

I have some questions about jFiles:

- can I override the jFiles class somehow. Currently when I override it, the compiler starts complaining when I use methods that use "JSONClass" in the prototype, I guess I have to override all these method too?

- how can easily override the default properties of the constructor/start method globally. I currently hack the constructor to fill my needs (in jFiles.clw), but that's not the way it should work

- what is "MaxPrefixLengthInJSON" actually used for. Now it only deletes prefixes when the the prefix length is smaller than 4 characters and that gave some unexpected results when importing to a Queue with a prefix that is longer than 4 characters ...

- in the latest release there are tons of calls to .GetFieldName(A) and .AdjustFieldname that slow down considerablly when there is more than 2 records to import. Can this be resolved without hacking the jFiles.clw?

TIA,
Ton

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: JFiles : some questions
« Reply #1 on: December 12, 2017, 06:15:29 AM »
Hi Ton,

>> - can I override the jFiles class somehow.

yes. But it's more complicated than would be typical, because jFiles creates a lot of nodes "of itself" internally. Some methods (the ones I've typically embedded in) deal with this, but not all methods can be overridden.

>> Currently when I override it, the compiler starts complaining when I use methods that use "JSONClass" in the prototype, I guess I have to override all these method too?

depends how you override it I guess. I'd probably need an example to be sure.

>> - how can easily override the default properties of the constructor/start method globally. I currently hack the constructor to fill my needs (in jFiles.clw), but that's not the way it should work

you'd embed in Start I think.
Basically, create a derived class (.inc, .clw) - then just put some nwe stuff in .Start, and call the parent. You can do things in the CONSTRUCT, but jFiles is deisgned that .Start returns it to a "default state"- so that's a better place to set defaults.

>> - what is "MaxPrefixLengthInJSON" actually used for. Now it only deletes prefixes when the the prefix length is smaller than 4 characters and that gave some unexpected results when importing to a Queue with a prefix that is longer than 4 characters ...

the place I use it the most is in NetTalk Web Service Methods. Dealing with prefixes there is a bit painful because : is not a legal char on the web.

>> - in the latest release there are tons of calls to .GetFieldName(A) and .AdjustFieldname that slow down considerably when there is more than 2 records to import. Can this be resolved without hacking the jFiles.clw?

I'm always looking to improve performance, so if you have suggestions on that front the easiest is to make the changes and then send them to me. If they are generically faster then of course I can just fold them into the class. However be warned, those are not as simple as they look.
GetFieldName is primarily called from FillStructure, but FillStructure is recursive, so if GetFieldName is
to cache the name then it needs to be aware it can be called for different groups. Which gets twicky.

cheers
Bruce

AtoB

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: JFiles : some questions
« Reply #2 on: December 12, 2017, 07:11:35 AM »
Hi Bruce,

>>you'd embed in Start I think.

as I use it in a handcoded context, this won't work I guess. Modifying the constructor will stay my preferred method then

with regard to the "MaxPrefixLengthInJSON" property: I still don't get why you want to remove some prefixes of a certain length only, Why do you want to keep the prefix -only- when it's longer than 4 characters, for example?

I'll try to improve the class if I have some extra spare time during the holidays ... no guarantee though :-)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: JFiles : some questions
« Reply #3 on: December 13, 2017, 12:22:26 AM »
Hi Ton,

>> As I use it in a handcoded context, this won't work I guess.

huh? of course it would work... I use Jfiles, with overridden methods in hand-code all the time.
For example see build 10.13, netmaps.clw file. search for JSON and you'll see a few cases where I override a method.

>> with regard to the "MaxPrefixLengthInJSON" property: I still don't get why you want to remove some prefixes of a certain length only, Why do you want to keep the prefix -only- when it's longer than 4 characters, for example?

because sometimes the _ char indicates a prefix, and sometimes not. For example;
cus_name ; cus is a prefix
customer_list ; customer is not a prefix

Cheers
Bruce