#1 2017-02-22 16:31:36

fakie
Banned
Registered: 2016-10-28
Posts: 36

Pushing data into an object for a report and when to use square bracks

Hi there.

I'm trying to assign data to a report via the ".data" method.
something like this..

newobject "test"
Loop "1" "3" "[I]"
  Loop "1" "4" "[J]"
    ObjectGetProp "[HC1.Response]" "[I].[J]" "[myvalue]"
    VarIsUndefined "[myvalue]" "[Result]"
    If "[Result]" "==" "true"
      AlertBox "[I].[J] = varisundef" "warn"
    Else
      ObjectsetProp "test" "A" "[I].[J]"
      ObjectsetProp "test" "B" "[myvalue]"
      ArrayPush "[Report1.Data]" "[test]"
    Endif
  EndLoop
EndLoop

But I get an error :

[e] Error: "[ngRepeat:dupes] http://errors.angularjs.org/1.6.1/ngRepeat/dupes?p0=Record%20in%20Report1.Data%20%7C%20filter%3AReport1.Query%20%7C%20orderBy%3AReport1.Order&p1=object%3A31&p2=%7B%22A%22%3A%223.3%22%2C%22B%22%3A9%2C%22%24%24hashKey%22%3A%22object%3A31%22%7D" - Line: 306 - Char: 13 - Code: 0 - Url: http://127.0.0.1:9999/app/scripts/app.js
[e] Error: "[$rootScope:inprog] http://errors.angularjs.org/1.6.1/$rootScope/inprog?p0=%24digest" - Line: 140 - Char: 496 - Code: 0 - Url: http://127.0.0.1:9999/builder/scripts/builder.js

I am trying to list the properties .. with a column A and a column B
In my report.html I have something like...

<td>[Record.A]</td>
<td>[Record.B]</td>

I also tried..

<td>[test.A]</td>
<td>[test.B]</td>

The other thing - and I'm sorry to ask two questions in one...
When do I use "test" and when do I use "[test]"
As I understand it the only time to use "test" is when you create a new object. All other times you use square brackets.

Or could I create an object from a variable if i use square brackets?
ie.

SetVar "[hallo]" "test" String
NewObject "[hallo]"
//Did we created a new object called test? 

Last edited by fakie (2017-02-22 16:34:21)


This is my favourite quote.

Offline

#2 2017-02-22 16:42:18

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Pushing data into an object for a report and when to use square bracks

Hello fakie,

Are you tried with the "Report4" sample? Because in fact they use the [Report.Data] variable instead of the Report's URL, so I think that's exactly what you wanted. Please take a look at that sample. And, about your other question, in general we can use both "[brackets]" and "nobrackets" when deal with variables in actions, however, as a recomendation probably it's a good thing to always use the brackets with actions' arguments variables.

Offline

#3 2017-02-22 17:13:52

fakie
Banned
Registered: 2016-10-28
Posts: 36

Re: Pushing data into an object for a report and when to use square bracks

Thanks. That was fast!

I solved my problem -
1.    I used ObjectsetProp "[test]" "B" "[myvalue]"  and not  ObjectsetProp "test" "B" "[myvalue]"
2.    I used test.A in my report - but seems the builtin variable Record.A must be used.

Thanks!


This is my favourite quote.

Offline

#4 2017-02-22 17:17:46

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: Pushing data into an object for a report and when to use square bracks

Hello fakie,

fakie wrote:

Thanks. That was fast!

I solved my problem -
1.    I used ObjectsetProp "[test]" "B" "[myvalue]"  and not  ObjectsetProp "test" "B" "[myvalue]"
2.    I used test.A in my report - but seems the builtin variable Record.A must be used.

Thanks!

Yes; certainly for that reason (too much actions to remember all of them right now!) I always recommend to use the brackets when variables, except if the help said something else.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.