/scripts/ahub.form.attachments.js
0

Capture the last record before BLANK cell appears on a Measure

Nov 17, 2016 at 12:43 AM

34

avatar image

Hello Folks,

I'm trying to Capture the last value of a measure before the blank record appears in the column on Measure "Unit Price" in below screenshot.

Now, the challenge in below screenshot is for all the MONTHS (Jan to Dec), its a Bex Structure, therefore a STATIC column. Meaning if i run the Application given at any month of the year, i'll always see that structure, regardless i run in Apr, July or Sept.

Some thought?

Option 1 - We can capture each row by applying array loop iteration

Apply code for forEach(function(element, index) to locate blank cell.

Now, we know it can only be applied to a Dimension and in my case Dimension(Bex Structure, will never be blank).

Option 2 - Most Probably not the best way to do it.

DS.getData (measure, selection).

Repeat the above code 11 times covering all months and then Run If and Else statement to locate blank cell and then capture the cell before that.

Highly appreciate your wise advice, thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Mustafa Bensan Nov 17, 2016 at 02:31 AM
0

Hi Mohd,

It sounds like you are simply trying to get the measure value of the current month. In that case, why don't you calculate the current month based on the date using APPLICATION.getInfo().dateNowInternalFormat and then apply a DS.getData (measure, selection) only to the current month?

Regards,

Mustafa.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Simply Genius worked like a charm Mustafa. Thank you so much for excellent advise.

I can capture current month and check previous month value by -1, -2, and -3 to check if data exist on those months and display the one where data exists. As data may not exist in previous month so its good to check for last 3 or 4 months too. Good example would be my screenshot we are in Nov but there is no record for Oct.

Try to ignore proposed Option 2 that would be some junk :-)

1
Skip to Content