cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging Basic issue

Former Member
0 Kudos

Dear All i am new to WDJ recently trying to debug some source code, searched various articles but did not get what exactly i want. i have setup the debug environment and want to debug the below sample code to learn how to get values in the context etc.

my sample code is

String month = (new SimpleDateFormat("MM").format(new Date()));

wdContext.currentContextElement().setCtx_date(month);

i have add breakpoint on the first line, now when i click Run-> Debug the code stops at the first line.

my question is how do i check current value of setCtx_date from 2nd line.

in the Variables window i can see the following expandable nodes but donot know which node to click so that i can get to read the current values. the variable windows shows something like this:->

this = Overview(id=589)

-> wdComponentAPI = DelegatingComponent (id= 600)

-> wdContext = IPrivateOverview$IContextNode (id=601)

->wdControllerAPI = DelegatingView (id =591)

-> wdThis= internalOverview(id=590)

Edited by: Jack on Sep 27, 2011 12:37 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Once control is on the line

wdContext.currentContextElement().setCtx_date(month);

Select month variable and right click and select "Investigate/check" (I do not remember the exact name).

You will see the value of this variable below the section where you see:

this = Overview(id=589)

-> wdComponentAPI = DelegatingComponent (id= 600)

-> wdContext = IPrivateOverview$IContextNode (id=601)

->wdControllerAPI = DelegatingView (id =591)

-> wdThis= internalOverview(id=590)

Former Member
0 Kudos

i selected the month and right clciked on it and clciked watch and i got the value thanks.

but my final query in this statement, refer 2nd line , how do i read the setCtx_Date value?

String month = (new SimpleDateFormat("MM").format(new Date()));

wdContext.currentContextElement().setCtx_date(month);

when i try to see the value in the :-

this = Overview(id=589)

1-> wdComponentAPI = DelegatingComponent (id= 600)

2-> wdContext = IPrivateOverview$IContextNode (id=601)

3->wdControllerAPI = DelegatingView (id =591)

4-> wdThis= internalOverview(id=590)

it keep on expanding and expanding dunno where to check, shall i check on line 1 or 2 or 3 or 4??

what is the actual node to check, can you please help

Former Member
0 Kudos

also if my debug steps into a if conditions how rto check if conditions values ??

Former Member
0 Kudos

You can select the entire expression and click on INSPECT.

For example

select wdContext.currentContextElement() and click on INSPECT...

You will get a specific tree structure which you can explore for all the nested values.

Regarding your IF statement...

suppose you have a statement

if(a.b.c(x()))

Then select entire a.b.c(x()) to inspect the value.

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

you can add watch point. if you are programmer, you should know it:)

Edited by: John Wu on Sep 27, 2011 9:58 AM