How to add sort by Location in Business Function B3102270

detroit1

Active Member
Hi,

Can someone help me how to add a sort by Location to the Business Function B3102270, I have identified the location where data is being pulled from F3111, but I am lacking the appropriate coding to do the sorting before the data is pulled. Any help would be welcome, a portion of the code is copied below for reference.

memset((void*) &dsGetItemBranch, (int) _J('\0'), sizeof(dsGetItemBranch) ) ;
memset((void*) &dsKEY1_F3111, (int) _J('\0'), sizeof(dsKEY1_F3111) ) ;
memset((void*) &dsF3111, (int) _J('\0'), sizeof(dsF3111) ) ;
memset((void*) &dsB3102270IDX, (int) _J('\0'), sizeof(dsB3102270IDX) ) ;
memset((void*) &dsB3102270BOM, (int) _J('\0'), sizeof(dsB3102270BOM) ) ;
ZeroMathNumeric(&mnTOTIS);


MathCopy(&dsKEY1_F3111.wmdoco, &lpdsWorkCache->mnOrderNumber);

JDEDBResultF3111 = JDB_FetchKeyed(hRequestF3111,
(ID)IndexIDF3111,
(void *)(&dsKEY1_F3111),
(short)(1),
(void *)(&dsF3111),
(int)(NULL));


/* end else cache did not exist */
JDEDBResultF3111 = JDB_FetchMatchingKey(hRequestF3111, (void *)(&dsKEY1_F3111),
(short)(1),
(void *)(&dsF3111),
(int)(NULL));
} /* end while records exist in F3111 */
Thanks,
 
Hi,

Anytime for sorting, SORT Structure needs to be defined as given below

SORTSTRUCT dsSort[1] = {0}; /*This depends on how much parameter the data needs to be sorted.*/

/*Set Sort*/
jdeNIDcpy(dsSort[0].Item.szDict, NID_LOCN);
jdeNIDcpy(dsSort[0].Item.szTable, NID_F3111);
dsSort[0].Item.idInstance = 0;
dsSort[0].nSort = JDEDB_SORT_ASC;
JDEDBResult = JDB_ClearSequencing(lpdsTables->hRequestF3111);
JDEDBResult = JDB_SetSequencing(lpdsTables->hRequestF3111,
dsSort,(ushort) 3,
JDEDB_SET_REPLACE);


Then followed by JDB_SelectKeyed and JDB_Fetch calls.

Hope this helps...

Thanks
Ram



detroit1 <[email protected]> wrote:
Hi,

Can someone help me how to add a sort by Location to the Business Function B3102270, I have identified the location where data is being pulled from F3111, but I am lacking the appropriate coding to do the sorting before the data is pulled. Any help would be welcome, a portion of the code is copied below for reference.

memset((void*) &dsGetItemBranch, (int) _J('\0'), sizeof(dsGetItemBranch) ) ;
memset((void*) &dsKEY1_F3111, (int) _J('\0'), sizeof(dsKEY1_F3111) ) ;
memset((void*) &dsF3111, (int) _J('\0'), sizeof(dsF3111) ) ;
memset((void*) &dsB3102270IDX, (int) _J('\0'), sizeof(dsB3102270IDX) ) ;
memset((void*) &dsB3102270BOM, (int) _J('\0'), sizeof(dsB3102270BOM) ) ;
ZeroMathNumeric(&mnTOTIS);


MathCopy(&dsKEY1_F3111.wmdoco, &lpdsWorkCache->mnOrderNumber);

JDEDBResultF3111 = JDB_FetchKeyed(hRequestF3111,
! (ID)IndexIDF3111,
(void *)(&dsKEY1_F3111),
(short)(1),
(void *)(&dsF3111),
(int)(NULL));


/* end else cache did not exist */
JDEDBResultF3111 = JDB_FetchMatchingKey(hRequestF3111, (void *)(&dsKEY1_F3111),
(short)(1),
(void *)(&dsF3111),
(int)(NULL));
} /* end while records exist in F3111 */
Thanks,
Analyst/Programmer PE1 B9
 
Hi,

Thanks for your reply, I tried using the code you have given, I get the following error during compilation:

****
************CMFGBASE************

B3102270.c
d:\B9\DV9\source\B3102270.c(7025) : error C2065: 'JDEDBResult' : undeclared identifier
d:\B9\DV9\source\B3102270.c(7025) : error C2065: 'lpdsTables' : undeclared identifier
d:\B9\DV9\source\B3102270.c(7025) : error C2223: left of '->hRequestF3111' must point to struct/union
d:\B9\DV9\source\B3102270.c(7025) : error C2198: 'JDB_ClearSequencing' : too few actual parameters
d:\B9\DV9\source\B3102270.c(7026) : error C2223: left of '->hRequestF3111' must point to struct/union
d:\B9\DV9\source\B3102270.c(7027) : warning C4047: 'function' : 'struct sequenceinfo *' differs in levels of indirection from 'unsigned short '
d:\B9\DV9\source\B3102270.c(7027) : warning C4024: 'JDB_SetSequencing' : different types for formal and actual parameter 2
d:\B9\DV9\source\B3102270.c(7028) : error C2198: 'JDB_SetSequencing' : too few actual parameters
jdertdll.c

**********
************Build Finished************

CMFGBASE.dll - 6 error(s), 2 warning(s): Build failed. Restored previous dll.
*********

Please appologize as my C skills are poor, what variables do i have to declare other than the "SORTSTRUCTURE".

I would appreciate if you could help me on that.

Thanks a million.
 
Back
Top