Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Maintain -- Any Simple Way to Compare Two Entire Stack Rows?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SHARING] Maintain -- Any Simple Way to Compare Two Entire Stack Rows?
 Login/Join
 
Virtuoso
posted
Here's what I want to do -- compare Stack row 1 to stack row 2 and see if there are any differences. Do I need to do this field by field, explicitly specifying each in a massive OR clause or is there a way to compare the entire rows to each other? Or perhaps a subscript way to reference the columns so that I can build a short loop? Essentially what I'm looking to do is this --

If StkUserInformation(1) EQ StkUserInformation(2) then begin
.
.
.
endbegin

This message has been edited. Last edited by: Kerry,



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Platinum Member
posted Hide Post
You can add to the MFD a single 'Group Field' that covers all of the fields in the table.
See the Documentation of GROUP Fields.
Then you can just compare ...
IF GRP NE LAST GRP

But if this is a relational database you can't use LAST but I assume you know how to get the two records you want to compare.


Release 7.6.9
Windows
HTML
 
Posts: 226 | Registered: June 08, 2003Report This Post
Virtuoso
posted Hide Post
.


Who was that masked man?


J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Virtuoso
posted Hide Post
.


Error [FOC03651] in madap_dev/Madap_Applicant_Information.WINFORMS' at or near line 8: The command Group Field Keys is not yet implemented.

I'd love to see a .all attribute added to Maintain stacks. That would be pretty sweet.

J.

This message has been edited. Last edited by: John_Edwards,



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Platinum Member
posted Hide Post
John,

Yes, a '.all' would be cool !

But in the meantime, perhaps you could Compute a new field in your stack that is the concatenation of all the fields - and then do your comparisons on that pseudo-Group field.
It will take a bit of explicit coding, depending on how many fields you have, but then the comparison code would be very simple.


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report This Post
Master
posted Hide Post
Dave just beat me to the suggestion. However, instead of doing a COMPUTE into a stack, you COULD do a define in the Master:
DEFINE FULLNAME/A50 = FRST | LA;$

You could then compare the records. So no, there is no way to compare a record except field by field. However, you could either create a Defined field or a Computed field.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Virtuoso
posted Hide Post
Comparing the fields would be easier methinks.

J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Virtuoso
posted Hide Post
You could always throw everything into a Stack of a0, and just compare those. It might be a little easier.
MAINTAIN FILE car

Case Top

carstk/stack of a0;

case1();

case2();

EndCase

Case case1

for all next car.country car.car car.model car.bodytype into carstack;

EndCase

Case case2

Repeat carstack.foccount cntr/i4=1;

  carstk(cntr) = carstack(cntr).country;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).car;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).model;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).bodytype;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).seats;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).dealer_cost;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).retail_cost;
  carstk(cntr) = carstk(cntr) | '/' | carstack(cntr).sales;

endRepeat cntr=cntr+1;

Repeat carstk.foccount cntr=1;
  type "*** <carstk(cntr) ";
endRepeat cntr=cntr+1;

EndCase
END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
Yeah, just comparing all the fields individually instead of concatenating all the individual fields lets me ignore all the type-casting headaches. That seems like the most reasonable solution.

If there isn't a function that's OK. I just didn't want to do the long form if there was a proper way to do it in a shorter form that I was not aware of.

Thanks folks!

J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Virtuoso
posted Hide Post
John

What type-casting headaches do you mean?


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
I believe there is a way to compare the columns.

There are Maintain internal functions and objects that may do the trick, but it is very low level, and I have only touched on it once about 10 years ago, and that was to dynamically change the colouring of screen objects from withing maintain.

Mark (MaintainWizard) are you still at IBI ? Someone there may give you the info. There is an expansive object hierarchy inside maintain that may be usable to do this sort of thing.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
I looked at the Object-Oriented stuff that nobody uses, but it doesn't work for the stack stuff.

I could build a separate case, but I have to do it for about a dozen different tables, for each only once. So all the case would do is add one more level of misdirection without making anything shorter or simpler.

Do I mark a thread "solved" if the answer is pretty much that I can't do what I would like to?

J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Virtuoso
posted Hide Post
How about "[HOPELESS]"?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
I am about 90% sure this can be done, I'll have a look in to it, may take a lot of time though, but would be quite useful.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
quote:
Object-Oriented stuff that nobody uses


Unfortunately, I have used the Object Oriented Stuff.

Have a look at this.
MAINTAIN FILE CAR

MODULE IMPORT (mntstkz FOCCOMP);

Declare ( msc/mnt_StackCompare; ) ;

Case Top
Compute
i/i8;
testres/I9 ;

INFER CAR.ORIGIN.COUNTRY CAR.COMP.CAR CAR.CARREC.MODEL INTO stkCAR1 ;
INFER CAR.ORIGIN.COUNTRY CAR.COMP.CAR CAR.CARREC.MODEL INTO stkCAR2 ;
INFER CAR.ORIGIN.COUNTRY CAR.COMP.CAR CAR.CARREC.MODEL INTO stkCAR3 ;
INFER CAR.ORIGIN.COUNTRY CAR.COMP.CAR INTO stkCAR4 ;

FOR ALL NEXT CAR.ORIGIN.COUNTRY CAR.COMP.CAR CAR.CARREC.MODEL INTO stkCARS ;

Stack Copy From stkCARS Into stkCAR1(1) Where (COUNTRY EQ 'ENGLAND') ;
Stack Copy From stkCARS Into stkCAR2(1) Where (COUNTRY EQ 'ENGLAND') ;
Stack Copy From stkCARS Into stkCAR3(1) Where (COUNTRY EQ 'FRANCE') ;
Stack Copy From stkCARS Into stkCAR4(1) Where (COUNTRY EQ 'ENGLAND') ;


testres = Compare_Stacks("Stacks the same",stkCAR1,stkCAR2,1,1) ;
testres = Compare_Stacks("Data Different" ,stkCAR1,stkCAR3,1,1) ;
$$testres = Compare_Stacks("Stacks Different" ,stkCAR1,stkCAR4,1,1) ;

Endcase

Case Compare_Stacks TAKES varTest/A0, stk1/anyType, stk2/anyType, row1/I9, row2/I9 RETURNS varCompRes/I1 ;

Type "<varTest" ;

msc.Init(stk1,stk2) ;
msc.AllocCompareBuf();
varCompRes = msc.IsRowSame(row1,row2) ;

Type "Compare Result = <varCompRes" ;

Endcase

END


The key parts are:

  • MODULE IMPORT (mntstkz FOCCOMP);
  • Declare ( msc/mnt_StackCompare; ) ;
  • Case Compare_Stacks


As mentioned earlier in this post, there are internal functions in Maintain that "may do the trick", well this is one of them.

There is a hidden library called mntstkz, this has many methods, one of them is comparing stacks.

But be aware, that if the stacks structures are not the same, it will EXIT the maintain pgm.

I personally would like these libraries documented.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Now we're gettin' warm.

Thanks bud -- I'll have a look at that. Since I am comparing records in the same stack the chance of the rows having a different format is zero.

For the moment you have replaced Derwin as my geek-idol.

J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Expert
posted Hide Post
I was hoping for Greek Idol Big Grin


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Maintain -- Any Simple Way to Compare Two Entire Stack Rows?

Copyright © 1996-2020 Information Builders