Dynamic values from "forcase function"

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Dynamic values from "forcase function"

Post by Yass »

Hi

I applied this lines of codes below and it working but i will like it to do more. I want a situation that
my selection in BRANCH_ID in a case will not appear as part of the dynamic values in my next case.

To explain further:

Case P1000061 - I had the following values :
  • 12 Denpsar
    13 Meila
    14 St Louis
// then i select 13 - Meila for BRANCH_ID
In case P1000062 I will like to see
  • 12 Denpsar
    14 St Louis
// the case P100062 should exclude my earlier selection

Please is it possible, if yes I really need help !!!

Code: Select all

PROC BRANCH_ID
onfocus

numeric nextEntry = 1;

forcase BRANCH_DICT where TAX_ID = XTAX_ID do
	codesString(nextEntry) = key(BRANCH_DICT);
		
	labels(nextEntry) = maketext("%s ", strip(XADDRESS));
	nextEntry = nextEntry + 1;
endfor;

if nextEntry = 1 then
	
	errmsg("No BRANCH FOUND");
	reenter COMPANY_NAME;
endif;

codesString(nextEntry) = "";
setvalueset(BRANCH_ID, codesString, labels);
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Dynamic values from "forcase function"

Post by Gregory Martin »

One option would be to have a flag in your BRANCH_DICT that indicates whether or not that value was selected previously. If that were the case, then your loop would look like this:
forcase BRANCH_DICT where TAX_ID = XTAX_ID and SELECTED = 0 do
Then, after the selection of the BRANCH_ID, you would do something like this, setting that selected variable to true:
TAX_ID = BRANCH_ID; // if this is not correct, set the BRANCH_DICT IDs properly

loadcase(BRANCH_DICT,TAX_ID);

SELECTED = 1;

writecase(BRANCH_DICT);
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Re: Dynamic values from "forcase function"

Post by Yass »

Thanks Greg and am observing another issue , now when i run from a menu , the external (.csdb) does not load automatically.
If I run the main app and i select the external data file it works perfect. I have write the external file already in the .pff. I might be doing something
wrong.

The code you share works perfectly the way i want it ... Thanks so much !!!! :)
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Dynamic values from "forcase function"

Post by Gregory Martin »

It is likely a problem with how you are you specifying the file in the PFF. We have run many menu applications that use .csdb files.

Compare the PFF that is generated when you run the program with the one that is created by your menu program to see what the differences are.
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Re: Dynamic values from "forcase function"

Post by Yass »

Hi Greg

Thanks , it works now but a quick one ... is it a way to hide a protected field from the case tree on an android device. Thus geo-codes that passed from the menu to the main application. Example the province code, province name etc are hidden from the case tree !!


Thanks
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Dynamic values from "forcase function"

Post by Gregory Martin »

If you right-click on the field and select Properties (where you specify "Protected"), you can select "Hide in Case Tree." In logic, you can also do this with the setproperty function ("HideInCaseTree") if using CSPro 7.1.
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Re: Dynamic values from "forcase function"

Post by Yass »

Thanks Greg !!!!
Post Reply