// ViewController.m
// app
//
// Created by John Kim on 2021/10/27.
//
#import "ViewController.h"
#import <OZRViewer/OZReportAPI.h>
@interface ViewController ()
@end
@implementation ViewController
@synthesize viewer, OZViewer;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self performSelector:@selector(createViewer) withObject:nil afterDelay:0.1];
}
-(void)createViewer{
NSString* ozserverUrl = @"http://oz.ozeform.io/oz/server";
NSString* ozrFileName = @"demo/customer.ozr";
NSString* paramStr = [NSString stringWithFormat:@"connection.servlet=%@\n", ozserverUrl];
paramStr = [NSString stringWithFormat:@"%@connection.reportname=%@", paramStr, ozrFileName];
OZReportViewer* newViewer = [OZReportAPI createViewer:self view:self.OZViewer listener:self param:paramStr closeButton:nil];
self.viewer = newViewer;
}
- (IBAction)Submit:(id)sender {
NSString* validity = [self.viewer GetInformation:@"INPUT_CHECK_VALIDITY"];
if ([validity isEqualToString:@"valid"]) {
NSString* inputData = [self.viewer GetInformation:@"INPUT_JSON_ALL"];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Input data" message:inputData preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:closeAction];
[self presentViewController:alert animated:YES completion:nil];
}
}
@end