Load and with

Anybody can explain the difference between load and with functions?

  Discussion posts and replies are publicly visible

Parents
  • 1. You can define multiple local variable either Inside load() or with() but you can't perform save operation over the variables which
    are defined inside with() whereas we can save the data into a variable which is defined inside load()

    2. Variables defined in load() instantiate for only once whereas variables defined in with() will be evaluated for each interaction
    on form, like sort, search, input a value in field etc. However forcefully you can dynamically change the value of the variables defined on load() as well.

    3. Performance wise load() is faster than with() because of only once execution.

    4. Any consistent values should be maintained in the variables defined in load() where as maintain those variables in
    with() which are expected to change its value based on given input.
Reply
  • 1. You can define multiple local variable either Inside load() or with() but you can't perform save operation over the variables which
    are defined inside with() whereas we can save the data into a variable which is defined inside load()

    2. Variables defined in load() instantiate for only once whereas variables defined in with() will be evaluated for each interaction
    on form, like sort, search, input a value in field etc. However forcefully you can dynamically change the value of the variables defined on load() as well.

    3. Performance wise load() is faster than with() because of only once execution.

    4. Any consistent values should be maintained in the variables defined in load() where as maintain those variables in
    with() which are expected to change its value based on given input.
Children
  • 0
    A Score Level 1
    in reply to yamunar0001

    It's simply not true to say that load() is faster than with() - they are extremely similar functions that satisfy slightly different requirements. Neither one is any faster than the other, but incorrect use of with() could cause your interface to perform poorly.

    Use of load() and with() as part of an expression makes no difference at all as far as speed is concerned.