4 Replies Latest reply on Oct 29, 2015 3:09 AM by AdamWilden

    WinCalc formatting for easy read...

    Expert

      Hi,

       

      I have a window with about 50 fields that I need to apply a calculation to, and even splitting it up it is going to result in some horribly long lines of code.

       

      I've been looking at syntax to break long lines to make them easier to work with.  I believe that we can't simply use Value += as this tries to parse before concatenating.

       

      So the best I can come up with (that works with LANDesk's interpreter) is the example below, which at least allows me to format it so that each attribute can have its own line -  and leaves all the variables easily referenced from the last line.

       

      But it's still a tad clunky (e.g. having to include empty quotes  to allow for the + concatenation).

       

       

        return String.Format(

      ":SetHidden(User,{1});:SetReadOnly(User{0});" +

      ":SetHidden(_Name,{0});:SetReadOnly(_Name,{0});:SetMandatory(_Name, {0});" +

      ":SetHidden(_InputGroup,{1});:SetReadOnly(_InputGroup,{0});" +

      ":SetHidden(_IsNew,{2});:SetReadOnly(_IsNew,{0});" +

      "", Visible, Mandatory, Readonly)

       

      Another example:

       

      return String.Format(

      //

      ":SetReadOnly(ConfigurationItemType,{1});" +

      ":SetReadOnly(ConfigurationItem,{1});" +

      ":SetReadOnly(_OrgChannelType,{1});" +

      ":SetReadOnly(_WebNavOrgChannel,{1});" +

      ":SetReadOnly(_WebNavServiceGroup,{1});" +

      ":SetReadOnly(_ParentServiceGroup,{1});" +

      ":SetReadOnly(_Name,{1});" +

      ":SetReadOnly(_AssetTitle,{1});" +

      ":SetReadOnly(_RollOverText,{1});" +

      ":SetReadOnly(_URL,{1});" +

      ":SetReadOnly(_DocumentType,{1});" +

      ":SetReadOnly(Colour,{1});" +

      ":SetReadOnly(_PrimaryContact,{1});" +

      ":SetReadOnly(_ReviewDate,{1});" +

      //

      "", true, false)

       

       

      Anyone know any simpler/better ways or improvements?

       

      Cheers - Adam.

       

      (Oh for the  day when calcs can reference form controls such as labels and groupboxes - would drastically reduce my workload and the length of these things!).