LightSwitch HTML Client: How to set the value of a computed property based on another computed property -
before asking question, make simple example make question clear.
in lightswitch html client, have table 1 column: "amount"
i made computed property, "amountplustax" , set value follow,
myapp.browsetransactions.amountplustax_postrender = function (element, contentitem) { contentitem.databind("data.amount", function () { $(element).text(parsefloat(contentitem.data.amount) * 1.05); }); };
as see, amountplustax = amount * 1.05
the problem have want make computed property value depends on value of "amountplustax" computed property. like, amountplustaxplusinterest = amountplustax * 1.03
how possible?
this doesn't work:
myapp.browsetransactions.amountplustaxplusinterest_postrender = function (element, contentitem) { $(element).text(parsefloat(contentitem.screen.amountplustax) * 1.03); };
although doesn't directly answer question, alternatively capture inserting/inserted/updating/updated events in dataservice , update 1 or both of fields instead of using computed properties.
for example:
partial void sometable_updating(sometable entity) { if (entity.somefield.isnullorwhitespace()) entity.somefield = utils.converttovalidname(entity.name); }
Comments
Post a Comment