Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preserving data if not NULL
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01156159
Message ID:
01156176
Views:
16
I think this should handle it. I hope we do always have NULL in FK and not empty:
if (IsNull(cursor_trans_stage.cDischarge_status_code_fk) ;
				and isnull(cursor_trans_stage.cAdmit_type_code_fk) ;
				and isnull(cursor_trans_stage.cAdmit_Source_code_fk)) or ;
			   (nvl(cursor_trans_stage.cDischarge_status_code_fk,"A") == ;
			    nvl(Load_Trans.cDischarge_status_code_fk,"A") and ;
			    nvl(cursor_trans_stage.cAdmit_type_code_fk,"A") == ;
			    nvl(Load_Trans.cAdmit_type_code_fk,"A") and ;
			    nvl(cursor_trans_stage.cAdmit_Source_code_fk,"A") == ;
			    nvl(Load_Trans.cAdmit_Source_code_fk,"A"))
				** Do nothing - all empty or exactly the same
			else
				replace cDischarge_status_code_fk ;
				with nvl(Load_Trans.cDischarge_status_code_fk, ;
				cursor_trans_stage.cDischarge_status_code_fk), ;
				cAdmit_type_code_fk ;
				with nvl(Load_Trans.cAdmit_type_code_fk, ;
				cursor_trans_stage.cAdmit_type_code_fk), ;
				cAdmit_Source_code_fk ;
				with nvl(Load_Trans.cAdmit_Source_code_fk, ;
				cursor_trans_stage.cAdmit_Source_code_fk) in Load_Trans	
		    endif	
>Hi everybody,
>
>I'm wondering if there is a way to preserve data without writing several case statements.
>
>Here is my current code
>
>replace cDischarge_status_code_fk ;
>	with cursor_trans_stage.cDischarge_status_code_fk, ;
>			cAdmit_type_code_fk ;
>			with cursor_trans_stage.cAdmit_type_code_fk, ;
>			cAdmit_Source_code_fk ;
>			with cursor_trans_stage.cAdmit_Source_code_fk in Load_Trans
>
>Now, if I have data in Load_Trans I don't want to replace.
>
>If I don't have data in 3 fields in cursor_trans_stage I don't want to touch Trans. That's first IF. If values in cursor are the same as in Trans, I don't want to touch Trans.
>
>Now, the third case can be handled by evl, correct?
>
>Looks like I cover them all?
>
>Actually, the data may be NULL and not empty. I don't see a simple way of preserving the info than writing lots of case statements...
>
>Thanks.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform